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

Version Description

Fix Elementor template display conditions reset and other minor fixes.

Download this release

Release Info

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

Code changes from version 1.0.1 to 1.0.2

LICENSE DELETED
@@ -1,339 +0,0 @@
1
- GNU GENERAL PUBLIC LICENSE
2
- Version 2, June 1991
3
-
4
- Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
5
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
- Everyone is permitted to copy and distribute verbatim copies
7
- of this license document, but changing it is not allowed.
8
-
9
- Preamble
10
-
11
- The licenses for most software are designed to take away your
12
- freedom to share and change it. By contrast, the GNU General Public
13
- License is intended to guarantee your freedom to share and change free
14
- software--to make sure the software is free for all its users. This
15
- General Public License applies to most of the Free Software
16
- Foundation's software and to any other program whose authors commit to
17
- using it. (Some other Free Software Foundation software is covered by
18
- the GNU Lesser General Public License instead.) You can apply it to
19
- your programs, too.
20
-
21
- When we speak of free software, we are referring to freedom, not
22
- price. Our General Public Licenses are designed to make sure that you
23
- have the freedom to distribute copies of free software (and charge for
24
- this service if you wish), that you receive source code or can get it
25
- if you want it, that you can change the software or use pieces of it
26
- in new free programs; and that you know you can do these things.
27
-
28
- To protect your rights, we need to make restrictions that forbid
29
- anyone to deny you these rights or to ask you to surrender the rights.
30
- These restrictions translate to certain responsibilities for you if you
31
- distribute copies of the software, or if you modify it.
32
-
33
- For example, if you distribute copies of such a program, whether
34
- gratis or for a fee, you must give the recipients all the rights that
35
- you have. You must make sure that they, too, receive or can get the
36
- source code. And you must show them these terms so they know their
37
- rights.
38
-
39
- We protect your rights with two steps: (1) copyright the software, and
40
- (2) offer you this license which gives you legal permission to copy,
41
- distribute and/or modify the software.
42
-
43
- Also, for each author's protection and ours, we want to make certain
44
- that everyone understands that there is no warranty for this free
45
- software. If the software is modified by someone else and passed on, we
46
- want its recipients to know that what they have is not the original, so
47
- that any problems introduced by others will not reflect on the original
48
- authors' reputations.
49
-
50
- Finally, any free program is threatened constantly by software
51
- patents. We wish to avoid the danger that redistributors of a free
52
- program will individually obtain patent licenses, in effect making the
53
- program proprietary. To prevent this, we have made it clear that any
54
- patent must be licensed for everyone's free use or not licensed at all.
55
-
56
- The precise terms and conditions for copying, distribution and
57
- modification follow.
58
-
59
- GNU GENERAL PUBLIC LICENSE
60
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
-
62
- 0. This License applies to any program or other work which contains
63
- a notice placed by the copyright holder saying it may be distributed
64
- under the terms of this General Public License. The "Program", below,
65
- refers to any such program or work, and a "work based on the Program"
66
- means either the Program or any derivative work under copyright law:
67
- that is to say, a work containing the Program or a portion of it,
68
- either verbatim or with modifications and/or translated into another
69
- language. (Hereinafter, translation is included without limitation in
70
- the term "modification".) Each licensee is addressed as "you".
71
-
72
- Activities other than copying, distribution and modification are not
73
- covered by this License; they are outside its scope. The act of
74
- running the Program is not restricted, and the output from the Program
75
- is covered only if its contents constitute a work based on the
76
- Program (independent of having been made by running the Program).
77
- Whether that is true depends on what the Program does.
78
-
79
- 1. You may copy and distribute verbatim copies of the Program's
80
- source code as you receive it, in any medium, provided that you
81
- conspicuously and appropriately publish on each copy an appropriate
82
- copyright notice and disclaimer of warranty; keep intact all the
83
- notices that refer to this License and to the absence of any warranty;
84
- and give any other recipients of the Program a copy of this License
85
- along with the Program.
86
-
87
- You may charge a fee for the physical act of transferring a copy, and
88
- you may at your option offer warranty protection in exchange for a fee.
89
-
90
- 2. You may modify your copy or copies of the Program or any portion
91
- of it, thus forming a work based on the Program, and copy and
92
- distribute such modifications or work under the terms of Section 1
93
- above, provided that you also meet all of these conditions:
94
-
95
- a) You must cause the modified files to carry prominent notices
96
- stating that you changed the files and the date of any change.
97
-
98
- b) You must cause any work that you distribute or publish, that in
99
- whole or in part contains or is derived from the Program or any
100
- part thereof, to be licensed as a whole at no charge to all third
101
- parties under the terms of this License.
102
-
103
- c) If the modified program normally reads commands interactively
104
- when run, you must cause it, when started running for such
105
- interactive use in the most ordinary way, to print or display an
106
- announcement including an appropriate copyright notice and a
107
- notice that there is no warranty (or else, saying that you provide
108
- a warranty) and that users may redistribute the program under
109
- these conditions, and telling the user how to view a copy of this
110
- License. (Exception: if the Program itself is interactive but
111
- does not normally print such an announcement, your work based on
112
- the Program is not required to print an announcement.)
113
-
114
- These requirements apply to the modified work as a whole. If
115
- identifiable sections of that work are not derived from the Program,
116
- and can be reasonably considered independent and separate works in
117
- themselves, then this License, and its terms, do not apply to those
118
- sections when you distribute them as separate works. But when you
119
- distribute the same sections as part of a whole which is a work based
120
- on the Program, the distribution of the whole must be on the terms of
121
- this License, whose permissions for other licensees extend to the
122
- entire whole, and thus to each and every part regardless of who wrote it.
123
-
124
- Thus, it is not the intent of this section to claim rights or contest
125
- your rights to work written entirely by you; rather, the intent is to
126
- exercise the right to control the distribution of derivative or
127
- collective works based on the Program.
128
-
129
- In addition, mere aggregation of another work not based on the Program
130
- with the Program (or with a work based on the Program) on a volume of
131
- a storage or distribution medium does not bring the other work under
132
- the scope of this License.
133
-
134
- 3. You may copy and distribute the Program (or a work based on it,
135
- under Section 2) in object code or executable form under the terms of
136
- Sections 1 and 2 above provided that you also do one of the following:
137
-
138
- a) Accompany it with the complete corresponding machine-readable
139
- source code, which must be distributed under the terms of Sections
140
- 1 and 2 above on a medium customarily used for software interchange; or,
141
-
142
- b) Accompany it with a written offer, valid for at least three
143
- years, to give any third party, for a charge no more than your
144
- cost of physically performing source distribution, a complete
145
- machine-readable copy of the corresponding source code, to be
146
- distributed under the terms of Sections 1 and 2 above on a medium
147
- customarily used for software interchange; or,
148
-
149
- c) Accompany it with the information you received as to the offer
150
- to distribute corresponding source code. (This alternative is
151
- allowed only for noncommercial distribution and only if you
152
- received the program in object code or executable form with such
153
- an offer, in accord with Subsection b above.)
154
-
155
- The source code for a work means the preferred form of the work for
156
- making modifications to it. For an executable work, complete source
157
- code means all the source code for all modules it contains, plus any
158
- associated interface definition files, plus the scripts used to
159
- control compilation and installation of the executable. However, as a
160
- special exception, the source code distributed need not include
161
- anything that is normally distributed (in either source or binary
162
- form) with the major components (compiler, kernel, and so on) of the
163
- operating system on which the executable runs, unless that component
164
- itself accompanies the executable.
165
-
166
- If distribution of executable or object code is made by offering
167
- access to copy from a designated place, then offering equivalent
168
- access to copy the source code from the same place counts as
169
- distribution of the source code, even though third parties are not
170
- compelled to copy the source along with the object code.
171
-
172
- 4. You may not copy, modify, sublicense, or distribute the Program
173
- except as expressly provided under this License. Any attempt
174
- otherwise to copy, modify, sublicense or distribute the Program is
175
- void, and will automatically terminate your rights under this License.
176
- However, parties who have received copies, or rights, from you under
177
- this License will not have their licenses terminated so long as such
178
- parties remain in full compliance.
179
-
180
- 5. You are not required to accept this License, since you have not
181
- signed it. However, nothing else grants you permission to modify or
182
- distribute the Program or its derivative works. These actions are
183
- prohibited by law if you do not accept this License. Therefore, by
184
- modifying or distributing the Program (or any work based on the
185
- Program), you indicate your acceptance of this License to do so, and
186
- all its terms and conditions for copying, distributing or modifying
187
- the Program or works based on it.
188
-
189
- 6. Each time you redistribute the Program (or any work based on the
190
- Program), the recipient automatically receives a license from the
191
- original licensor to copy, distribute or modify the Program subject to
192
- these terms and conditions. You may not impose any further
193
- restrictions on the recipients' exercise of the rights granted herein.
194
- You are not responsible for enforcing compliance by third parties to
195
- this License.
196
-
197
- 7. If, as a consequence of a court judgment or allegation of patent
198
- infringement or for any other reason (not limited to patent issues),
199
- conditions are imposed on you (whether by court order, agreement or
200
- otherwise) that contradict the conditions of this License, they do not
201
- excuse you from the conditions of this License. If you cannot
202
- distribute so as to satisfy simultaneously your obligations under this
203
- License and any other pertinent obligations, then as a consequence you
204
- may not distribute the Program at all. For example, if a patent
205
- license would not permit royalty-free redistribution of the Program by
206
- all those who receive copies directly or indirectly through you, then
207
- the only way you could satisfy both it and this License would be to
208
- refrain entirely from distribution of the Program.
209
-
210
- If any portion of this section is held invalid or unenforceable under
211
- any particular circumstance, the balance of the section is intended to
212
- apply and the section as a whole is intended to apply in other
213
- circumstances.
214
-
215
- It is not the purpose of this section to induce you to infringe any
216
- patents or other property right claims or to contest validity of any
217
- such claims; this section has the sole purpose of protecting the
218
- integrity of the free software distribution system, which is
219
- implemented by public license practices. Many people have made
220
- generous contributions to the wide range of software distributed
221
- through that system in reliance on consistent application of that
222
- system; it is up to the author/donor to decide if he or she is willing
223
- to distribute software through any other system and a licensee cannot
224
- impose that choice.
225
-
226
- This section is intended to make thoroughly clear what is believed to
227
- be a consequence of the rest of this License.
228
-
229
- 8. If the distribution and/or use of the Program is restricted in
230
- certain countries either by patents or by copyrighted interfaces, the
231
- original copyright holder who places the Program under this License
232
- may add an explicit geographical distribution limitation excluding
233
- those countries, so that distribution is permitted only in or among
234
- countries not thus excluded. In such case, this License incorporates
235
- the limitation as if written in the body of this License.
236
-
237
- 9. The Free Software Foundation may publish revised and/or new versions
238
- of the General Public License from time to time. Such new versions will
239
- be similar in spirit to the present version, but may differ in detail to
240
- address new problems or concerns.
241
-
242
- Each version is given a distinguishing version number. If the Program
243
- specifies a version number of this License which applies to it and "any
244
- later version", you have the option of following the terms and conditions
245
- either of that version or of any later version published by the Free
246
- Software Foundation. If the Program does not specify a version number of
247
- this License, you may choose any version ever published by the Free Software
248
- Foundation.
249
-
250
- 10. If you wish to incorporate parts of the Program into other free
251
- programs whose distribution conditions are different, write to the author
252
- to ask for permission. For software which is copyrighted by the Free
253
- Software Foundation, write to the Free Software Foundation; we sometimes
254
- make exceptions for this. Our decision will be guided by the two goals
255
- of preserving the free status of all derivatives of our free software and
256
- of promoting the sharing and reuse of software generally.
257
-
258
- NO WARRANTY
259
-
260
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
- FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
- OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
- PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
- OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
- TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
- PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
- REPAIR OR CORRECTION.
269
-
270
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
- WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
- REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
- INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
- OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
- TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
- YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
- PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
- POSSIBILITY OF SUCH DAMAGES.
279
-
280
- END OF TERMS AND CONDITIONS
281
-
282
- How to Apply These Terms to Your New Programs
283
-
284
- If you develop a new program, and you want it to be of the greatest
285
- possible use to the public, the best way to achieve this is to make it
286
- free software which everyone can redistribute and change under these terms.
287
-
288
- To do so, attach the following notices to the program. It is safest
289
- to attach them to the start of each source file to most effectively
290
- convey the exclusion of warranty; and each file should have at least
291
- the "copyright" line and a pointer to where the full notice is found.
292
-
293
-
294
- Copyright (C) 2018 David Decker
295
-
296
- This program is free software; you can redistribute it and/or modify
297
- it under the terms of the GNU General Public License as published by
298
- the Free Software Foundation; either version 2 of the License, or
299
- (at your option) any later version.
300
-
301
- This program is distributed in the hope that it will be useful,
302
- but WITHOUT ANY WARRANTY; without even the implied warranty of
303
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
- GNU General Public License for more details.
305
-
306
- You should have received a copy of the GNU General Public License along
307
- with this program; if not, write to the Free Software Foundation, Inc.,
308
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309
-
310
- Also add information on how to contact you by electronic and paper mail.
311
-
312
- If the program is interactive, make it output a short notice like this
313
- when it starts in an interactive mode:
314
-
315
- Gnomovision version 69, Copyright (C) year name of author
316
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317
- This is free software, and you are welcome to redistribute it
318
- under certain conditions; type `show c' for details.
319
-
320
- The hypothetical commands `show w' and `show c' should show the appropriate
321
- parts of the General Public License. Of course, the commands you use may
322
- be called something other than `show w' and `show c'; they could even be
323
- mouse-clicks or menu items--whatever suits your program.
324
-
325
- You should also get your employer (if you work as a programmer) or your
326
- school, if any, to sign a "copyright disclaimer" for the program, if
327
- necessary. Here is a sample; alter the names:
328
-
329
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
-
332
- {signature of Ty Coon}, 1 April 1989
333
- Ty Coon, President of Vice
334
-
335
- This General Public License does not permit incorporating your program into
336
- proprietary programs. If your program is a subroutine library, you may
337
- consider it more useful to permit linking proprietary applications with the
338
- library. If this is what you want to do, use the GNU Lesser General
339
- Public License instead of this License.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
README.md DELETED
@@ -1,306 +0,0 @@
1
- # Polylang Connect for Elementor - Language Switcher & Template Tweaks
2
- **Contributors:** [daveshine](https://profiles.wordpress.org/daveshine), [p4fbradjohnson](https://profiles.wordpress.org/p4fbradjohnson), [deckerweb](https://profiles.wordpress.org/deckerweb), [wpautobahn](https://profiles.wordpress.org/wpautobahn)
3
- **Donate link:** https://www.paypal.me/deckerweb
4
- **Tags:** elementor, polylang, multilingual, language switcher, languages, templates, widget, finder, dynamic tags, deckerweb
5
- **Requires at least:** 4.7
6
- **Tested up to:** 5.4
7
- **Requires PHP:** 5.6
8
- **Stable tag:** 1.0.0
9
- **License:** GPL-2.0-or-later
10
- **License URI:** https://opensource.org/licenses/GPL-2.0
11
-
12
- Connect Polylang with Elementor - show correct Templates, plus Elementor language switcher widget.
13
-
14
- [<img src="https://raw.githubusercontent.com/deckerweb/connect-polylang-elementor/master/assets-repos/github-com/cpel-banner.png" data-canonical-src="https://raw.githubusercontent.com/deckerweb/connect-polylang-elementor/master/assets-repos/github-com/cpel-banner.png" width="772" height="250" />](https://wordpress.org/plugins/connect-polylang-elementor/)
15
-
16
-
17
- ## Description
18
-
19
-
20
- Connect the Polylang multilingual plugin with Elementor Page Builder: This plugin will make Elementor and Polylang **show the correct language templates**, especially with Elementor Pro Theme Builder. Plus: native **Polylang Language Switcher Elementor widget**, new Dynamic Tags, and Polylang links added to the **Elementor Finder** feature.
21
-
22
- [![Video of Plugin's Live Demo and Walkthrough](https://img.youtube.com/vi/tMmJ6sdMdxw/0.jpg)](https://www.youtube.com/watch?v=tMmJ6sdMdxw)
23
- [**original video link**](https://www.youtube.com/watch?v=tMmJ6sdMdxw) *by plugin developer David Decker*
24
-
25
-
26
- ### What the Plugin Does
27
- * **Shows the correct Template** (for different languages): Polylang Connect for Elementor allows Polylang to show the correct Elementor template to be displayed on the front end. Before this plugin, Elementor did not show the correct language (translated) template.
28
- * Beyond enabling the Elementor post type in Polylang settings, plus assigning every post/page/template to a language, no further settings are needed for these template tweaks. It just works out of the box. All the heavy lifting happens under the hood.
29
- * **Usage Example:**
30
- * Make a header template in Elementor, set display conditions in Elementor panel, assign this to one language (English for example)
31
- * Make a second header template in Elementor, set NO display conditions for this one (by assigning 2 of the same display conditions, you can create a conflict in Elementor), but assign to another Polylang language (Portuguese for example), meaning to link those languages/templates in Polylang.
32
- * Result: when viewing in frontend the proper English content appears with the English header template, translated content in Portuguese appears with the Portuguese header template.
33
- * Go on: The principle is always the same, now add German language, Spanish and so on ;-)
34
- * [See **live demo** on co-author's own website](https://passion4fashion.pt/) // [Screenshot gallery](https://www.dropbox.com/sh/3i9tuh76etmhl1a/AADm_4L_aesp8Q9ss5NXuSiMa?dl=0)
35
-
36
-
37
- ### Plus: Even More Features
38
- * **Polylang Language Switcher Widget**: A native Elementor Widget to easily build a nice language switcher menu and have **more styling options** for non-coders at hand
39
- * **Elementor Finder integration**: Adds Polylang languages, admin settings links, plus support resources as quick jump links to the Elementor Finder feature (Elementor v2.3.0+) - so you can navigate more quickly from whereever you are
40
- * **Dynamic Tags** in Elementor Pro: Polylang Language Names (all registered/active) / Current Language Name / Current Language Code / Current Language Flag (image) / Current Language URL
41
-
42
-
43
- ### Further Plugin Info
44
- * More features might be added in the future.
45
- * Community collaboration between David Decker and Brad Johnson, and more code coming from the Elementor/Polylang community
46
-
47
-
48
- ### Translations
49
- * English (default, `en_US`) - always included
50
- * German (`de_DE`) - always included
51
- * German formal (`de_DE_formal`) - always included
52
- * `.pot` file (`connect-polylang-elementor.pot`) for translators is also always included :)
53
- * Easy plugin translation platform with GlotPress tool: [Translate "Polylang Connect for Elementor"...](https://translate.wordpress.org/projects/wp-plugins/connect-polylang-elementor)
54
-
55
-
56
- ### Feedback
57
- * I am open for your suggestions and feedback - Thank you for using or trying out one of my plugins!
58
- * Join our [**Facebook User Community Support Group**](https://www.facebook.com/groups/deckerweb.wordpress.plugins/)
59
-
60
-
61
- ### My Other Plugins
62
- * [**Toolbar Extras for Elementor - WordPress Admin Bar Enhanced**](https://wordpress.org/plugins/connect-polylang-elementor/)
63
- * [**Builder Template Categories - for WordPress Page Builders**](https://wordpress.org/plugins/builder-template-categories/)
64
- * [**Simple Download Manager for WP Document Revisions**](https://wordpress.org/plugins/wpdr-simple-downloads/)
65
- * [Genesis What's New Info](https://wordpress.org/plugins/genesis-whats-new-info/)
66
- * [Genesis Layout Extras](https://wordpress.org/plugins/genesis-layout-extras/)
67
- * [Genesis Widgetized Not Found & 404](https://wordpress.org/plugins/genesis-widgetized-notfound/)
68
- * [Genesis Widgetized Footer](https://wordpress.org/plugins/genesis-widgetized-footer/)
69
- * [Genesis Widgetized Archive](https://wordpress.org/plugins/genesis-widgetized-archive/)
70
- * [Multisite Toolbar Additions](https://wordpress.org/plugins/multisite-toolbar-additions/)
71
- * [Cleaner Plugin Installer](https://wordpress.org/plugins/cleaner-plugin-installer/)
72
-
73
-
74
-
75
- ## Installation
76
-
77
-
78
- ### Minimum Requirements
79
-
80
- * WordPress version 4.7 or higher
81
- * [Elementor](https://wordpress.org/plugins/elementor/) and [Polylang](https://wordpress.org/plugins/polylang/) plugins - free versions from WordPress.org Plugin Directory
82
- * **Optional:** *Elementor Pro* which is needed for Theme Building possibilities (Header templates etc.). This is a paid premium product by Elementor LTD, [available via elementor.com](https://toolbarextras.com/go/elementor-pro/)
83
- * PHP version 5.6 or higher
84
- * MySQL version 5.0 or higher
85
-
86
-
87
- ### We Recommend Your Host Supports at least:
88
-
89
- * PHP version 7.0 or higher
90
- * MySQL version 5.6 or higher / or MariaDB 10 or higher
91
-
92
-
93
- ### Installation
94
-
95
- 1. Install using the WordPress built-in Plugin installer (via **Plugins > Add New** - search for `connect polylang elementor`), or extract the ZIP file and drop the contents in the `wp-content/plugins/` directory of your WordPress installation.
96
- 2. Activate the plugin through the 'Plugins' menu in WordPress.
97
- 3. Go to **Polylang > Settings > Custom post types and Taxonomies**, enable the "My Templates" post type (Elementor)
98
- 4. Assign languages to your pages/ posts/ Elementor templates
99
- 5. For Elementor templates: set display conditions in Elementor for one template only (your main language is recommended) - templates in the other languages will then get loaded via this plugin magically! :)
100
- 6. Additionally use the native Elementor Widget: Polylang Switcher
101
-
102
-
103
-
104
- ## Frequently Asked Questions
105
-
106
-
107
- ### Is there a live demo?
108
-
109
- Yes, there is.
110
-
111
- [**See live demo on co-author's own website**](https://passion4fashion.pt/)
112
-
113
- [Plus: *bigger* versions of the above screenshots are in this external gallery ;-)](https://www.dropbox.com/sh/3i9tuh76etmhl1a/AADm_4L_aesp8Q9ss5NXuSiMa?dl=0)
114
-
115
-
116
-
117
- ### Correct Elementor template does not show up?
118
-
119
- Every page/ post/ template must be assigned a language for this to work. This is standard PolyLang procedure but it should be noted in case "it doesnt work".
120
-
121
- Also, for Elementor Templates, the post type must be enabled for Polylang support: Go to **Polylang > Settings > Custom post types and Taxonomies**, enable the "My Templates" post type (Elementor).
122
-
123
-
124
-
125
- ### Where is the Elementor Widget to found?
126
-
127
- It's in the widget category "General Elements". Plus, if Elementor Pro is active and you're editing a template, the widget additionally appears in the "Site" widget category.
128
-
129
- When searching for widgets type "polylang" or "languages" and it will show up immediately! ;-)
130
-
131
-
132
-
133
- ### Where is the plugin's settings page?
134
-
135
- This plugin has NO settings page, as it does not need one. All it does works just under the hood. Activate the plugin. Done.
136
-
137
- (If there will be settings needed in the future, we might add options in later plugin versions.)
138
-
139
-
140
-
141
- ### Is Polylang Pro supported?
142
-
143
- Yes, it is! :)
144
- All features of "Polylang Connect for Elementor" work with both, *Polylang* (free) AND *Polylang Pro* (Premium).
145
-
146
-
147
-
148
- ### Are custom flags supported?
149
-
150
- In general, [custom flags](https://polylang.pro/doc/can-i-use-my-own-flags-for-the-language-switcher/) are supported in the Polylang Switcher Elementor widget and in the Dynamic Tag (Current Language Flag).
151
- However, the default flags in Polylang are sized `16px` wide and `11px` high, this automatically applies to custom flags - as it is fully handled internally by Polylang.
152
-
153
- To use a different size for custom flags we are trying to find ways to implement this for Elementor in future versions of this plugin.
154
-
155
-
156
-
157
- ### Typography and uppercase settings?
158
-
159
- In the Polylang Switcher Elementor widget there are typography settings available for the Switcher menu items. These settings are CSS based of course, and applied "globally" to the various states they are for: normal, hover, active (current language). The available toggles for uppercase are done code-wise and therefore have a lower priority - this means the CSS always takes over, if wanted. That way you are most flexible with quick settings (toggles) but have all styling options at hand if needed.
160
-
161
-
162
-
163
- ### Is Elementor plugin needed?
164
-
165
- Yes, it is. Otherwise this connect plugin won't do anything. Elementor is available for free on WordPress.org.
166
-
167
- The Elementor Pro Add-On plugin is needed for the Theme Builder capabilities (for example Header templates), plus the feature of "Dynamic Tags". So it is highly recommended. But if it is not installed/ activated, the depending features from the connect plugin won't even load. So it is all optional.
168
-
169
- The language switcher widget only needs Elementor base plugin to work ;-)
170
-
171
-
172
-
173
- ### Other recommended plugins for multilingual websites?
174
-
175
- There are quite a few:
176
-
177
- * [**Country Flags for Elementor**](https://wordpress.org/plugins/country-flags-for-elementor/) - Native Elementor widget
178
- * [**Polylang Pro** (Premium)](https://polylang.pro/downloads/polylang-pro/) - The official premium version with more features, plus premium support
179
- * [**Polylang for WooCommerce** (Premium)](https://polylang.pro/downloads/polylang-for-woocommerce/) - Makes WooCommerce multilingual - official Polylang Add-On
180
- * [**Lingotek Translation**](https://wordpress.org/plugins/lingotek-translation/) - Native Polylang integration - Lingotek brings convenient cloud-based localization and translation for WordPress
181
- * [**Integrate Gravity Forms + Polylang**](https://wordpress.org/plugins/integrate-gravity-forms-polylang/) - Add form titles, descriptions, field labels, etc. to Polylang string translations
182
- * [**WPML to Polylang**](https://wordpress.org/plugins/wpml-to-polylang/) - From the Polylang developer himself
183
-
184
-
185
-
186
- ### More info on Translations?
187
-
188
- * English - default, always included
189
- * German (de_DE): Deutsch - immer dabei! :-)
190
- * For custom and update-safe language files please upload them to `/wp-content/languages/connect-polylang-elementor/` (just create this folder) - This enables you to use fully custom translations that won't be overridden on plugin updates. Also, complete custom English wording is possible with that as well, just use a language file like `connect-polylang-elementor-en_US.mo/.po` to achieve that (for creating one see the following tools).
191
-
192
- **Easy WordPress.org plugin translation platform with GlotPress platform:** [**Translate "Polylang Connect for Elementor"...**](https://translate.wordpress.org/projects/wp-plugins/connect-polylang-elementor)
193
-
194
- *Note:* All my plugins are internationalized/ translateable by default. This is very important for all users worldwide. So please contribute your language to the plugin to make it even more useful. For translating and validating I recommend the awesome ["Poedit Editor"](https://www.poedit.net/), which works fine on Windows, macOS and Linux.
195
-
196
-
197
-
198
- ## Screenshots
199
-
200
-
201
- ### 1. Ensure that my templates is ticked in PolyLang post types and Taxonomies. Although the plugin will automatically tick this for you 😊
202
- ![Ensure that my templates is ticked in PolyLang post types and Taxonomies. Although the plugin will automatically tick this for you 😊](https://ps.w.org/connect-polylang-elementor/assets/screenshot-1.png)
203
-
204
-
205
- ### 2. Header Template in Elementor showing that they have both been translated
206
- ![Header Template in Elementor showing that they have both been translated](https://ps.w.org/connect-polylang-elementor/assets/screenshot-2.png)
207
-
208
-
209
- ### 3. PolyLang Widget in Elementor under Site
210
- ![PolyLang Widget in Elementor under Site](https://ps.w.org/connect-polylang-elementor/assets/screenshot-3.png)
211
-
212
-
213
- ### 4. PolyLang Widget options in Elementor
214
- ![PolyLang Widget options in Elementor](https://ps.w.org/connect-polylang-elementor/assets/screenshot-4.png)
215
-
216
-
217
- ### 5. PolyLang Widget Styling Options in Elementor
218
- ![PolyLang Widget Styling Options in Elementor](https://ps.w.org/connect-polylang-elementor/assets/screenshot-5.png)
219
-
220
-
221
- ### 6. Set your primary language display conditions for your primary language
222
- ![kkkk](https://ps.w.org/connect-polylang-elementor/assets/screenshot-6.png)
223
-
224
-
225
- ### 7. DO NOT SET A DISPLAY CONDITION FOR ANY OTHER LANGUAGE ---> PolyLang will do this for you. Save without conditions
226
- ![Set your primary language display conditions for your primary language](https://ps.w.org/connect-polylang-elementor/assets/screenshot-7.png)
227
-
228
-
229
- ### 8. (1/2) Working language header templates on the front end. Styled by the widget. Previously this was not an option in PolyLang. (other than editing the menu options) PolyLang users could not display language codes but now they can 😉. Thanks to Polylang Connect for Elementor.
230
- ![(1/2) Working language header templates on the front end. Styled by the widget. Previously this was not an option in PolyLang. (other than editing the menu options) PolyLang users could not display language codes but now they can 😉. Thanks to Polylang Connect for Elementor.](https://ps.w.org/connect-polylang-elementor/assets/screenshot-8.png)
231
-
232
-
233
- ### 9. (2/2) Working language header templates on the front end. Styled by the widget. Previously this was not an option in PolyLang. (other than editing the menu options) PolyLang users could not display language codes but now they can 😉. Thanks to Polylang Connect for Elementor.
234
- ![(2/2) Working language header templates on the front end. Styled by the widget. Previously this was not an option in PolyLang. (other than editing the menu options) PolyLang users could not display language codes but now they can 😉. Thanks to Polylang Connect for Elementor.](https://ps.w.org/connect-polylang-elementor/assets/screenshot-9.png)
235
-
236
-
237
-
238
-
239
- ## Changelog
240
-
241
- ### 1.0.1 - 2020-06-17
242
-
243
- * Stability update for edge cases were experiencing fatal errors
244
- * Thanks to sebastienserre for correct fatal unknow pll_the_languages();
245
-
246
- ### 1.0.0 - 2018-11-28
247
- * Official public release on WordPress.org
248
-
249
-
250
- ### 0.9.1 - 2018-11-27
251
- * *First Release Candidate (RC) version*
252
- * New: Automatic enabling of Elementor My Templates post type for Polylang support
253
- * Tweak: Code improvements throughout
254
- * Tweak: Inline documentation and PHP doc improvements
255
-
256
-
257
- ### 0.9.0 - 2018-11-26
258
- * *Second beta version*
259
- * New: More settings for Polylang Switcher widget
260
- * Tweak: Improved Dynamic Tags additions
261
- * Tweak: Improved Elementor Finder integration
262
-
263
-
264
- ### 0.8.0 - 2018-11-25
265
- * *First beta version*
266
- * New: Added native Elementor Widget - Polylang Language Switcher
267
- * New: Added Dynamic Tags for Polylang (requires Elementor Pro)
268
-
269
-
270
- ### 0.7.0 - 2018-11-24
271
- * *Second alpha version*
272
- * New: Added Elementor Finder integration for Polylang plugin links and resources
273
- * New: Make plugin translateable - added full German translations
274
- * New: Added Readme file, plus `composer.json`
275
- * New: First public alpha release on GitHub
276
-
277
-
278
- ### 0.5.0 - 2018-10-30
279
- * *Plugin idea by Brad*
280
- * *First alpha version by David*
281
- * New: Template tweaks work in form of plugin code - coding standards improvements
282
-
283
-
284
-
285
- ## Upgrade Notice
286
-
287
-
288
- ### 1.0.0
289
- Just released into the wild.
290
-
291
-
292
- ## Donate
293
- Enjoy using *Polylang Connect for Elementor*? [**Please consider making a donation**](https://www.paypal.me/deckerweb) to support the project's continued development.
294
-
295
-
296
- ## Credits
297
- Credit where credit is due. The following code/ classes, all licensed under the GPL. Note: Credit is also referenced in the code doc block inline where used.
298
-
299
- * Polylang Switcher class (Elementor Widget) and its CSS based on widget from plugin "Language Switcher for Elementor" by Solitweb (GPLv2 or later)
300
-
301
-
302
- ## Plugin Links
303
- * [Translations (WP GlotPress Platform)](https://translate.wordpress.org/projects/wp-plugins/connect-polylang-elementor)
304
- * [User support forums](https://wordpress.org/support/plugin/connect-polylang-elementor)
305
- * [Polylang Users Facebook Group](https://www.facebook.com/groups/polylang.users/)
306
- * [DECKERWEB WordPress Plugins Facebook Group](https://www.facebook.com/groups/deckerweb.wordpress.plugins/)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt → README.txt RENAMED
@@ -1,11 +1,11 @@
1
  === Polylang Connect for Elementor - Language Switcher & Template Tweaks ===
2
- Contributors: daveshine, p4fbradjohnson, deckerweb, wpautobahn
3
  Donate link: https://www.paypal.me/deckerweb
4
  Tags: elementor, polylang, multilingual, language switcher, languages, templates, widget, finder, dynamic tags, deckerweb
5
  Requires at least: 4.7
6
- Tested up to: 5.6
7
  Requires PHP: 5.6
8
- Stable tag: 1.0.1
9
  License: GPL-2.0-or-later
10
  License URI: https://opensource.org/licenses/GPL-2.0
11
 
@@ -54,24 +54,6 @@ https://www.youtube.com/watch?v=tMmJ6sdMdxw
54
  * I am open for your suggestions and feedback - Thank you for using or trying out one of my plugins!
55
  * Join our [**Facebook User Community Support Group**](https://www.facebook.com/groups/deckerweb.wordpress.plugins/)
56
 
57
- = My Other Plugins =
58
- * [**Toolbar Extras for Elementor - WordPress Admin Bar Enhanced**](https://wordpress.org/plugins/connect-polylang-elementor/)
59
- * [**Toolbar Extras for Oxygen Builder - Add-On plugin**](https://wordpress.org/plugins/toolbar-extras-oxygen/)
60
- * [**Toolbar Extras for MainWP Dashboard - Add-On plugin**](https://wordpress.org/plugins/toolbar-extras-mainwp/)
61
- * [**Toolbar Extras for Give Donations (GiveWP) - Add-On plugin**](https://wordpress.org/plugins/toolbar-extras-givewp/)
62
- * [**Builder Shortcode Extras – WordPress Shortcodes Collection to Save You Time**](https://wordpress.org/plugins/builder-shortcode-extras/)
63
- * [**Builder Template Categories - for WordPress Page Builders**](https://wordpress.org/plugins/builder-template-categories/)
64
- * [**Simple Download Manager for WP Document Revisions**](https://wordpress.org/plugins/wpdr-simple-downloads/)
65
- * [Genesis What's New Info](https://wordpress.org/plugins/genesis-whats-new-info/)
66
- * [Genesis Layout Extras](https://wordpress.org/plugins/genesis-layout-extras/)
67
- * [Genesis Widgetized Not Found & 404](https://wordpress.org/plugins/genesis-widgetized-notfound/)
68
- * [Genesis Extra Settings Transporter](https://wordpress.org/plugins/genesis-extra-settings-transporter/)
69
- * [Genesis Widgetized Footer](https://wordpress.org/plugins/genesis-widgetized-footer/)
70
- * [Genesis Widgetized Archive](https://wordpress.org/plugins/genesis-widgetized-archive/)
71
- * [Multisite Toolbar Additions](https://wordpress.org/plugins/multisite-toolbar-additions/)
72
- * [Cleaner Plugin Installer](https://wordpress.org/plugins/cleaner-plugin-installer/)
73
- * [*My plugins newsletter*](https://eepurl.com/gbAUUn)
74
-
75
 
76
  == Installation ==
77
 
@@ -85,7 +67,7 @@ https://www.youtube.com/watch?v=tMmJ6sdMdxw
85
 
86
  = We Recommend Your Host Supports at least: =
87
 
88
- * PHP version 7.2 or higher
89
  * MySQL version 5.6 or higher / or MariaDB 10 or higher
90
 
91
  = Installation =
@@ -161,7 +143,7 @@ Technically, Elementor Pro is not required - but highly recommended, though.
161
 
162
  Elementor Pro is required for these features of the plugin:
163
 
164
- * Translating Elementor Theme Builder Templates the version is required, otherwise this will not work.
165
  * Dynamic Tags, additionally added by the plugin
166
 
167
  For the other features of the plugin the regular free version of Elementor is sufficient - so the native Elementor language switcher widget will work also that way already ;-)
@@ -238,6 +220,20 @@ There are quite a few:
238
 
239
  == Changelog ==
240
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  = 1.0.0 - 2018-11-28 =
242
  * Official public release on WordPress.org
243
 
@@ -276,10 +272,14 @@ There are quite a few:
276
  * New: Template tweaks work in form of plugin code - coding standards improvements
277
 
278
 
 
279
  == Upgrade Notice ==
280
 
 
 
 
281
  = 1.0.1 =
282
- A fix for edge users were in certain cases Elementor Pro would not load.
283
 
284
  = 1.0.0 =
285
  Just released into the wild.
@@ -300,3 +300,4 @@ Credit where credit is due. The following code/ classes, all licensed under the
300
  * [User support forums](https://wordpress.org/support/plugin/connect-polylang-elementor)
301
  * [Polylang Users Facebook Group](https://www.facebook.com/groups/polylang.users/)
302
  * [DECKERWEB WordPress Plugins Facebook Group](https://www.facebook.com/groups/deckerweb.wordpress.plugins/)
 
1
  === Polylang Connect for Elementor - Language Switcher & Template Tweaks ===
2
+ Contributors: daveshine, p4fbradjohnson, deckerweb, wpautobahn, pacotole, creapuntome
3
  Donate link: https://www.paypal.me/deckerweb
4
  Tags: elementor, polylang, multilingual, language switcher, languages, templates, widget, finder, dynamic tags, deckerweb
5
  Requires at least: 4.7
6
+ Tested up to: 5.7
7
  Requires PHP: 5.6
8
+ Stable tag: 1.0.2
9
  License: GPL-2.0-or-later
10
  License URI: https://opensource.org/licenses/GPL-2.0
11
 
54
  * I am open for your suggestions and feedback - Thank you for using or trying out one of my plugins!
55
  * Join our [**Facebook User Community Support Group**](https://www.facebook.com/groups/deckerweb.wordpress.plugins/)
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
  == Installation ==
59
 
67
 
68
  = We Recommend Your Host Supports at least: =
69
 
70
+ * PHP version 7.3 or higher
71
  * MySQL version 5.6 or higher / or MariaDB 10 or higher
72
 
73
  = Installation =
143
 
144
  Elementor Pro is required for these features of the plugin:
145
 
146
+ * Translating Elementor Theme Builder Templates the version is required, otherwise this will not work.
147
  * Dynamic Tags, additionally added by the plugin
148
 
149
  For the other features of the plugin the regular free version of Elementor is sufficient - so the native Elementor language switcher widget will work also that way already ;-)
220
 
221
  == Changelog ==
222
 
223
+ = 1.0.2 - 2021-04-26 =
224
+ * Fix Elementor template display conditions reset
225
+ * Fix wp-cli error languages undefined
226
+ * Fix Elementor deprecations
227
+ * Added Elementor Landing Pages CPT translatable
228
+ * Added JetEngine Listing CPT translatable
229
+ * WordPress PHP Coding Standards
230
+
231
+
232
+ = 1.0.1 - 2020-06-17 =
233
+ * Stability update for edge cases were experiencing fatal errors
234
+ * Thanks to sebastienserre for correct fatal unknow pll_the_languages();
235
+
236
+
237
  = 1.0.0 - 2018-11-28 =
238
  * Official public release on WordPress.org
239
 
272
  * New: Template tweaks work in form of plugin code - coding standards improvements
273
 
274
 
275
+
276
  == Upgrade Notice ==
277
 
278
+ = 1.0.2 =
279
+ Fix Elementor template display conditions reset and other minor fixes.
280
+
281
  = 1.0.1 =
282
+ A fix for edge users were in certain cases Elementor Pro would not load.
283
 
284
  = 1.0.0 =
285
  Just released into the wild.
300
  * [User support forums](https://wordpress.org/support/plugin/connect-polylang-elementor)
301
  * [Polylang Users Facebook Group](https://www.facebook.com/groups/polylang.users/)
302
  * [DECKERWEB WordPress Plugins Facebook Group](https://www.facebook.com/groups/deckerweb.wordpress.plugins/)
303
+ * [**Creame** We are a digital design company](https://crea.me/)
connect-polylang-elementor.php CHANGED
@@ -1,6 +1,7 @@
1
- <?php # -*- coding: utf-8 -*-
2
  /**
3
  * Main plugin file.
 
4
  * @package Polylang Connect for Elementor
5
  * @author David Decker
6
  * @copyright Copyright (c) 2018, David Decker - DECKERWEB
@@ -11,7 +12,7 @@
11
  * Plugin Name: Polylang Connect for Elementor
12
  * Plugin URI: https://github.com/deckerweb/connect-polylang-elementor
13
  * Description: Connect the Polylang multilingual plugin with Elementor Page Builder: This plugin will make Elementor and Polylang show the correct language templates, especially with Elementor Pro Theme Builder. Plus: native Polylang Language Switcher Elementor widget, new Dynamic Tags, and Polylang links added to the Elementor Finder feature.
14
- * Version: 1.0.0
15
  * Author: David Decker - DECKERWEB
16
  * Author URI: https://deckerweb.de/
17
  * License: GPL-2.0-or-later
@@ -40,7 +41,7 @@ if ( ! defined( 'ABSPATH' ) ) {
40
  * @since 1.0.0
41
  */
42
  /** Plugin version */
43
- define( 'CPEL_PLUGIN_VERSION', '1.0.0' );
44
 
45
  /** File */
46
  define( 'CPEL__FILE__', __FILE__ );
@@ -92,18 +93,18 @@ function ddw_cpel_load_translations() {
92
  /** Translations: Secondly, look in 'wp-content/languages/plugins/' for the proper .mo file (= default) */
93
  load_plugin_textdomain(
94
  $cpel_textdomain,
95
- FALSE,
96
  CPEL_PLUGIN_BASEDIR . 'languages'
97
  );
98
 
99
- } // end function
100
 
101
 
102
  /** Include global functions */
103
- require_once( CPEL_PLUGIN_DIR . 'includes/functions-global.php' );
104
 
105
  /** Include (global) conditionals functions */
106
- require_once( CPEL_PLUGIN_DIR . 'includes/functions-conditionals.php' );
107
 
108
 
109
  add_action( 'plugins_loaded', 'ddw_cpel_setup_plugin', 20 );
@@ -117,22 +118,21 @@ function ddw_cpel_setup_plugin() {
117
  /** Load features that require Polylang & Elementor active */
118
  if ( ddw_cpel_is_polylang_active() && ddw_cpel_is_elementor_active() ) {
119
 
120
- require_once( CPEL_PLUGIN_DIR . 'modules/finder/manager.php' );
121
- require_once( CPEL_PLUGIN_DIR . 'modules/widgets/register-widget.php' );
122
 
123
  new \DDW_Connect_Polylang_Elementor\Register_Widget();
124
 
125
  /** Load features that require Elementor Pro */
126
  if ( ddw_cpel_is_elementor_pro_active() ) {
127
- require_once( CPEL_PLUGIN_DIR . 'modules/connect/tweaks-polylang-elementor.php' );
128
- require_once( CPEL_PLUGIN_DIR . 'modules/dynamic-tags/manager.php' );
129
  }
130
-
131
- } // end if
132
 
133
  /** Include admin helper functions */
134
  if ( is_admin() ) {
135
- require_once( CPEL_PLUGIN_DIR . 'includes/admin-extras.php' );
136
  }
137
 
138
  /** Add links to Settings and Menu pages to Plugins page */
@@ -148,6 +148,6 @@ function ddw_cpel_setup_plugin() {
148
  'ddw_cpel_custom_settings_links'
149
  );
150
 
151
- } // end if
152
 
153
- } // end function
1
+ <?php
2
  /**
3
  * Main plugin file.
4
+ *
5
  * @package Polylang Connect for Elementor
6
  * @author David Decker
7
  * @copyright Copyright (c) 2018, David Decker - DECKERWEB
12
  * Plugin Name: Polylang Connect for Elementor
13
  * Plugin URI: https://github.com/deckerweb/connect-polylang-elementor
14
  * Description: Connect the Polylang multilingual plugin with Elementor Page Builder: This plugin will make Elementor and Polylang show the correct language templates, especially with Elementor Pro Theme Builder. Plus: native Polylang Language Switcher Elementor widget, new Dynamic Tags, and Polylang links added to the Elementor Finder feature.
15
+ * Version: 1.0.2
16
  * Author: David Decker - DECKERWEB
17
  * Author URI: https://deckerweb.de/
18
  * License: GPL-2.0-or-later
41
  * @since 1.0.0
42
  */
43
  /** Plugin version */
44
+ define( 'CPEL_PLUGIN_VERSION', '1.0.2' );
45
 
46
  /** File */
47
  define( 'CPEL__FILE__', __FILE__ );
93
  /** Translations: Secondly, look in 'wp-content/languages/plugins/' for the proper .mo file (= default) */
94
  load_plugin_textdomain(
95
  $cpel_textdomain,
96
+ false,
97
  CPEL_PLUGIN_BASEDIR . 'languages'
98
  );
99
 
100
+ }
101
 
102
 
103
  /** Include global functions */
104
+ require_once CPEL_PLUGIN_DIR . 'includes/functions-global.php';
105
 
106
  /** Include (global) conditionals functions */
107
+ require_once CPEL_PLUGIN_DIR . 'includes/functions-conditionals.php';
108
 
109
 
110
  add_action( 'plugins_loaded', 'ddw_cpel_setup_plugin', 20 );
118
  /** Load features that require Polylang & Elementor active */
119
  if ( ddw_cpel_is_polylang_active() && ddw_cpel_is_elementor_active() ) {
120
 
121
+ require_once CPEL_PLUGIN_DIR . 'modules/finder/manager.php';
122
+ require_once CPEL_PLUGIN_DIR . 'modules/widgets/register-widget.php';
123
 
124
  new \DDW_Connect_Polylang_Elementor\Register_Widget();
125
 
126
  /** Load features that require Elementor Pro */
127
  if ( ddw_cpel_is_elementor_pro_active() ) {
128
+ require_once CPEL_PLUGIN_DIR . 'modules/connect/tweaks-polylang-elementor.php';
129
+ require_once CPEL_PLUGIN_DIR . 'modules/dynamic-tags/manager.php';
130
  }
131
+ }
 
132
 
133
  /** Include admin helper functions */
134
  if ( is_admin() ) {
135
+ require_once CPEL_PLUGIN_DIR . 'includes/admin-extras.php';
136
  }
137
 
138
  /** Add links to Settings and Menu pages to Plugins page */
148
  'ddw_cpel_custom_settings_links'
149
  );
150
 
151
+ }
152
 
153
+ }
includes/admin-extras.php CHANGED
@@ -38,8 +38,8 @@ function ddw_cpel_custom_settings_links( $cpel_links ) {
38
  esc_html__( 'Polylang Languages Setup', 'connect-polylang-elementor' ),
39
  esc_attr_x( 'Languages', 'Link title attribute for Polylang settings', 'connect-polylang-elementor' )
40
  );
41
-
42
- } // end if
43
 
44
  /** Elementor My Templates link */
45
  if ( ddw_cpel_is_elementor_active() ) {
@@ -52,9 +52,8 @@ function ddw_cpel_custom_settings_links( $cpel_links ) {
52
  esc_attr_x( 'Templates', 'Link title attribute for Elementor My Templates', 'connect-polylang-elementor' )
53
  );
54
 
55
- } // end if
56
-
57
- } // end if
58
 
59
  /** Set the order of the links */
60
  if ( ! empty( $link_polylang ) && ! empty( $link_elementor ) ) {
@@ -65,11 +64,11 @@ function ddw_cpel_custom_settings_links( $cpel_links ) {
65
  return apply_filters(
66
  'cpel/filter/plugins_page/settings_links',
67
  $cpel_links,
68
- $link_polylang, // additional param
69
- $link_elementor // additional param
70
  );
71
 
72
- } // end function
73
 
74
 
75
  add_filter( 'plugin_row_meta', 'ddw_cpel_plugin_links', 10, 2 );
@@ -117,7 +116,7 @@ function ddw_cpel_plugin_links( $cpel_links, $cpel_file ) {
117
  /* translators: Plugins page listing */
118
  $cpel_links[] = ddw_cpel_get_info_link( 'url_donate', esc_html_x( 'Donate', 'Plugins page listing', 'connect-polylang-elementor' ), 'button-primary dashicons-before dashicons-thumbs-up' );
119
 
120
- } // end if plugin links
121
 
122
  /** Output the links */
123
  return apply_filters(
@@ -125,7 +124,7 @@ function ddw_cpel_plugin_links( $cpel_links, $cpel_file ) {
125
  $cpel_links
126
  );
127
 
128
- } // end function
129
 
130
 
131
  /**
@@ -147,7 +146,7 @@ function ddw_cpel_plugin_update_message_style_tweak() {
147
  </style>
148
  <?php
149
 
150
- } // end function
151
 
152
 
153
  add_action( 'in_plugin_update_message-' . CPEL_PLUGIN_BASEDIR . 'connect-polylang-elementor.php', 'ddw_cpel_plugin_update_message', 10, 2 );
@@ -165,18 +164,18 @@ add_action( 'in_plugin_update_message-' . CPEL_PLUGIN_BASEDIR . 'connect-polylan
165
  */
166
  function ddw_cpel_plugin_update_message( $data, $response ) {
167
 
168
- if ( isset( $data[ 'upgrade_notice' ] ) ) {
169
 
170
  ddw_cpel_plugin_update_message_style_tweak();
171
 
172
  printf(
173
  '<div class="update-message cpel-update-message">%s</div>',
174
- wpautop( $data[ 'upgrade_notice' ] )
175
  );
176
 
177
- } // end if
178
 
179
- } // end function
180
 
181
 
182
  add_action( 'after_plugin_row_wp-' . CPEL_PLUGIN_BASEDIR . 'connect-polylang-elementor.php', 'ddw_cpel_multisite_subsite_plugin_update_message', 10, 2 );
@@ -194,7 +193,7 @@ add_action( 'after_plugin_row_wp-' . CPEL_PLUGIN_BASEDIR . 'connect-polylang-ele
194
  */
195
  function ddw_cpel_multisite_subsite_plugin_update_message( $file, $plugin ) {
196
 
197
- if ( is_multisite() && version_compare( $plugin[ 'Version' ], $plugin[ 'new_version' ], '<' ) ) {
198
 
199
  $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
200
 
@@ -203,10 +202,10 @@ function ddw_cpel_multisite_subsite_plugin_update_message( $file, $plugin ) {
203
  printf(
204
  '<tr class="plugin-update-tr"><td colspan="%s" class="plugin-update update-message notice inline notice-warning notice-alt"><div class="update-message cpel-update-message"><h4 style="margin: 0; font-size: 14px;">%s</h4>%s</div></td></tr>',
205
  $wp_list_table->get_column_count(),
206
- $plugin[ 'Name' ],
207
- wpautop( $plugin[ 'upgrade_notice' ] )
208
  );
209
 
210
- } // end if
211
 
212
- } // end function
38
  esc_html__( 'Polylang Languages Setup', 'connect-polylang-elementor' ),
39
  esc_attr_x( 'Languages', 'Link title attribute for Polylang settings', 'connect-polylang-elementor' )
40
  );
41
+
42
+ }
43
 
44
  /** Elementor My Templates link */
45
  if ( ddw_cpel_is_elementor_active() ) {
52
  esc_attr_x( 'Templates', 'Link title attribute for Elementor My Templates', 'connect-polylang-elementor' )
53
  );
54
 
55
+ }
56
+ }
 
57
 
58
  /** Set the order of the links */
59
  if ( ! empty( $link_polylang ) && ! empty( $link_elementor ) ) {
64
  return apply_filters(
65
  'cpel/filter/plugins_page/settings_links',
66
  $cpel_links,
67
+ $link_polylang, // additional param
68
+ $link_elementor // additional param
69
  );
70
 
71
+ }
72
 
73
 
74
  add_filter( 'plugin_row_meta', 'ddw_cpel_plugin_links', 10, 2 );
116
  /* translators: Plugins page listing */
117
  $cpel_links[] = ddw_cpel_get_info_link( 'url_donate', esc_html_x( 'Donate', 'Plugins page listing', 'connect-polylang-elementor' ), 'button-primary dashicons-before dashicons-thumbs-up' );
118
 
119
+ }
120
 
121
  /** Output the links */
122
  return apply_filters(
124
  $cpel_links
125
  );
126
 
127
+ }
128
 
129
 
130
  /**
146
  </style>
147
  <?php
148
 
149
+ }
150
 
151
 
152
  add_action( 'in_plugin_update_message-' . CPEL_PLUGIN_BASEDIR . 'connect-polylang-elementor.php', 'ddw_cpel_plugin_update_message', 10, 2 );
164
  */
165
  function ddw_cpel_plugin_update_message( $data, $response ) {
166
 
167
+ if ( isset( $data['upgrade_notice'] ) ) {
168
 
169
  ddw_cpel_plugin_update_message_style_tweak();
170
 
171
  printf(
172
  '<div class="update-message cpel-update-message">%s</div>',
173
+ wpautop( $data['upgrade_notice'] )
174
  );
175
 
176
+ }
177
 
178
+ }
179
 
180
 
181
  add_action( 'after_plugin_row_wp-' . CPEL_PLUGIN_BASEDIR . 'connect-polylang-elementor.php', 'ddw_cpel_multisite_subsite_plugin_update_message', 10, 2 );
193
  */
194
  function ddw_cpel_multisite_subsite_plugin_update_message( $file, $plugin ) {
195
 
196
+ if ( is_multisite() && version_compare( $plugin['Version'], $plugin['new_version'], '<' ) ) {
197
 
198
  $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
199
 
202
  printf(
203
  '<tr class="plugin-update-tr"><td colspan="%s" class="plugin-update update-message notice inline notice-warning notice-alt"><div class="update-message cpel-update-message"><h4 style="margin: 0; font-size: 14px;">%s</h4>%s</div></td></tr>',
204
  $wp_list_table->get_column_count(),
205
+ $plugin['Name'],
206
+ wpautop( $plugin['upgrade_notice'] )
207
  );
208
 
209
+ }
210
 
211
+ }
includes/functions-conditionals.php CHANGED
@@ -23,7 +23,7 @@ function ddw_cpel_is_elementor_active() {
23
 
24
  return defined( 'ELEMENTOR_VERSION' );
25
 
26
- } // end function
27
 
28
 
29
  /**
@@ -37,7 +37,7 @@ function ddw_cpel_is_elementor_pro_active() {
37
 
38
  return defined( 'ELEMENTOR_PRO_VERSION' );
39
 
40
- } // end function
41
 
42
 
43
  /**
@@ -53,7 +53,7 @@ function ddw_cpel_is_polylang_active() {
53
 
54
  return defined( 'POLYLANG_BASENAME' );
55
 
56
- } // end function
57
 
58
 
59
  /**
@@ -67,7 +67,7 @@ function ddw_cpel_is_polylang_pro_active() {
67
 
68
  return defined( 'POLYLANG_PRO' );
69
 
70
- } // end function
71
 
72
 
73
  /**
@@ -81,4 +81,4 @@ function ddw_cpel_is_polylang_free_active() {
81
 
82
  return ddw_cpel_is_polylang_active() && ! ddw_cpel_is_polylang_pro_active();
83
 
84
- } // end function
23
 
24
  return defined( 'ELEMENTOR_VERSION' );
25
 
26
+ }
27
 
28
 
29
  /**
37
 
38
  return defined( 'ELEMENTOR_PRO_VERSION' );
39
 
40
+ }
41
 
42
 
43
  /**
53
 
54
  return defined( 'POLYLANG_BASENAME' );
55
 
56
+ }
57
 
58
 
59
  /**
67
 
68
  return defined( 'POLYLANG_PRO' );
69
 
70
+ }
71
 
72
 
73
  /**
81
 
82
  return ddw_cpel_is_polylang_active() && ! ddw_cpel_is_polylang_pro_active();
83
 
84
+ }
includes/functions-global.php CHANGED
@@ -28,10 +28,10 @@ function ddw_cpel_prepare_render_polylang_switcher() {
28
  add_filter( 'elementor/widget/render_content', 'ddw_cpel_render_polylang_switcher', 10, 2 );
29
  }
30
 
31
- } // end function
32
 
33
 
34
- //add_filter( 'elementor/widget/render_content', 'ddw_cpel_render_polylang_switcher', 10, 2 );
35
  /**
36
  * Render the Polylang Switcher widget only on the frontend when the display
37
  * conditions of the widget's settings are met:
@@ -76,9 +76,9 @@ function ddw_cpel_render_polylang_switcher( $widget_content, $widget_instance )
76
 
77
  return '<!-- hidden widget -->';
78
 
79
- } // end if
80
 
81
- } // end function
82
 
83
 
84
  /**
@@ -98,7 +98,7 @@ function ddw_cpel_info_values() {
98
  'url_wporg_review' => 'https://wordpress.org/support/plugin/connect-polylang-elementor/reviews/?filter=5/#new-post',
99
  'url_wporg_profile' => 'https://profiles.wordpress.org/daveshine/',
100
  'url_fb_group' => 'https://www.facebook.com/groups/deckerweb.wordpress.plugins/',
101
- //'url_snippets' => 'https://github.com/deckerweb/connect-polylang-elementor/wiki/Code-Snippets',
102
  'author' => __( 'David Decker - DECKERWEB', 'connect-polylang-elementor' ),
103
  'author_uri' => 'https://deckerweb.de/',
104
  'license' => 'GPL-2.0-or-later',
@@ -106,8 +106,8 @@ function ddw_cpel_info_values() {
106
  'first_code' => '2018',
107
  'url_donate' => 'https://www.paypal.me/deckerweb',
108
  'url_plugin' => 'https://github.com/deckerweb/connect-polylang-elementor',
109
- //'url_plugin_docs' => 'https://github.com/deckerweb/connect-polylang-elementor/wiki',
110
- //'url_plugin_faq' => 'https://wordpress.org/plugins/connect-polylang-elementor/#faq',
111
  'url_github' => 'https://github.com/deckerweb/connect-polylang-elementor',
112
  'url_github_issues' => 'https://github.com/deckerweb/connect-polylang-elementor/issues',
113
  'url_twitter' => 'https://twitter.com/deckerweb',
@@ -117,7 +117,7 @@ function ddw_cpel_info_values() {
117
 
118
  return $cpel_info;
119
 
120
- } // end function
121
 
122
 
123
  /**
@@ -131,19 +131,19 @@ function ddw_cpel_info_values() {
131
  * @param bool $raw If raw escaping or regular escaping of URL gets used
132
  * @return string URL for info value.
133
  */
134
- function ddw_cpel_get_info_url( $url_key = '', $raw = FALSE ) {
135
 
136
  $cpel_info = (array) ddw_cpel_info_values();
137
 
138
  $output = esc_url( $cpel_info[ sanitize_key( $url_key ) ] );
139
 
140
- if ( TRUE === $raw ) {
141
  $output = esc_url_raw( $cpel_info[ esc_attr( $url_key ) ] );
142
  }
143
 
144
  return $output;
145
 
146
- } // end function
147
 
148
 
149
  /**
@@ -162,14 +162,14 @@ function ddw_cpel_get_info_link( $url_key = '', $text = '', $class = '' ) {
162
 
163
  $link = sprintf(
164
  '<a class="%1$s" href="%2$s" target="_blank" rel="nofollow noopener noreferrer" title="%3$s">%3$s</a>',
165
- strtolower( esc_attr( $class ) ), //sanitize_html_class( $class ),
166
  ddw_cpel_get_info_url( $url_key ),
167
  esc_html( $text )
168
  );
169
 
170
  return $link;
171
 
172
- } // end function
173
 
174
 
175
  /**
@@ -186,11 +186,11 @@ function ddw_cpel_coding_years( $first_year = '' ) {
186
 
187
  $cpel_info = (array) ddw_cpel_info_values();
188
 
189
- $first_year = ( empty( $first_year ) ) ? absint( $cpel_info[ 'first_code' ] ) : absint( $first_year );
190
 
191
  /** Set year of first released code */
192
  $code_first_year = ( date( 'Y' ) == $first_year || 0 === $first_year ) ? '' : $first_year . '&#x02013;';
193
 
194
  return $code_first_year . date( 'Y' );
195
 
196
- } // end function
28
  add_filter( 'elementor/widget/render_content', 'ddw_cpel_render_polylang_switcher', 10, 2 );
29
  }
30
 
31
+ }
32
 
33
 
34
+ // add_filter( 'elementor/widget/render_content', 'ddw_cpel_render_polylang_switcher', 10, 2 );
35
  /**
36
  * Render the Polylang Switcher widget only on the frontend when the display
37
  * conditions of the widget's settings are met:
76
 
77
  return '<!-- hidden widget -->';
78
 
79
+ }
80
 
81
+ }
82
 
83
 
84
  /**
98
  'url_wporg_review' => 'https://wordpress.org/support/plugin/connect-polylang-elementor/reviews/?filter=5/#new-post',
99
  'url_wporg_profile' => 'https://profiles.wordpress.org/daveshine/',
100
  'url_fb_group' => 'https://www.facebook.com/groups/deckerweb.wordpress.plugins/',
101
+ // 'url_snippets' => 'https://github.com/deckerweb/connect-polylang-elementor/wiki/Code-Snippets',
102
  'author' => __( 'David Decker - DECKERWEB', 'connect-polylang-elementor' ),
103
  'author_uri' => 'https://deckerweb.de/',
104
  'license' => 'GPL-2.0-or-later',
106
  'first_code' => '2018',
107
  'url_donate' => 'https://www.paypal.me/deckerweb',
108
  'url_plugin' => 'https://github.com/deckerweb/connect-polylang-elementor',
109
+ // 'url_plugin_docs' => 'https://github.com/deckerweb/connect-polylang-elementor/wiki',
110
+ // 'url_plugin_faq' => 'https://wordpress.org/plugins/connect-polylang-elementor/#faq',
111
  'url_github' => 'https://github.com/deckerweb/connect-polylang-elementor',
112
  'url_github_issues' => 'https://github.com/deckerweb/connect-polylang-elementor/issues',
113
  'url_twitter' => 'https://twitter.com/deckerweb',
117
 
118
  return $cpel_info;
119
 
120
+ }
121
 
122
 
123
  /**
131
  * @param bool $raw If raw escaping or regular escaping of URL gets used
132
  * @return string URL for info value.
133
  */
134
+ function ddw_cpel_get_info_url( $url_key = '', $raw = false ) {
135
 
136
  $cpel_info = (array) ddw_cpel_info_values();
137
 
138
  $output = esc_url( $cpel_info[ sanitize_key( $url_key ) ] );
139
 
140
+ if ( true === $raw ) {
141
  $output = esc_url_raw( $cpel_info[ esc_attr( $url_key ) ] );
142
  }
143
 
144
  return $output;
145
 
146
+ }
147
 
148
 
149
  /**
162
 
163
  $link = sprintf(
164
  '<a class="%1$s" href="%2$s" target="_blank" rel="nofollow noopener noreferrer" title="%3$s">%3$s</a>',
165
+ strtolower( esc_attr( $class ) ), // sanitize_html_class( $class ),
166
  ddw_cpel_get_info_url( $url_key ),
167
  esc_html( $text )
168
  );
169
 
170
  return $link;
171
 
172
+ }
173
 
174
 
175
  /**
186
 
187
  $cpel_info = (array) ddw_cpel_info_values();
188
 
189
+ $first_year = ( empty( $first_year ) ) ? absint( $cpel_info['first_code'] ) : absint( $first_year );
190
 
191
  /** Set year of first released code */
192
  $code_first_year = ( date( 'Y' ) == $first_year || 0 === $first_year ) ? '' : $first_year . '&#x02013;';
193
 
194
  return $code_first_year . date( 'Y' );
195
 
196
+ }
modules/connect/tweaks-polylang-elementor.php CHANGED
@@ -28,7 +28,7 @@ add_filter( 'pll_get_post_types', 'ddw_cpel_add_cpts_to_polylang', 10, 2 );
28
  function ddw_cpel_add_cpts_to_polylang( $post_types, $is_settings ) {
29
 
30
  /** Bail early if integration not wanted */
31
- if ( ! apply_filters( 'cpel/filter/polylang/posttypes_automatic', TRUE ) ) {
32
  return;
33
  }
34
 
@@ -36,26 +36,22 @@ function ddw_cpel_add_cpts_to_polylang( $post_types, $is_settings ) {
36
  $relevant_types = apply_filters(
37
  'cpel/filter/polylang/post_types',
38
  array(
39
- 'elementor_library', // Elementor
40
- 'oceanwp_library', // OceanWP Library
41
- 'astra-advanced-hook', // Astra Custom Layouts (Astra Pro)
42
- 'gp_elements', // GeneratePress Elements (GP Premium)
43
- 'jet-theme-core', // JetThemeCore (Kava Pro/ CrocoBlock)
44
- 'customify_hook', // Customify (Customify Pro)
45
- 'wpbf_hooks', // Page Builder Framework Sections (WPBF Premium)
46
- 'ae_global_templates', // AnyWhere Elementor plugin
 
 
47
  )
48
  );
49
 
50
- /** Add all post types to Polylang */
51
- foreach ( $relevant_types as $relevant_type ) {
52
- $post_types[ $relevant_type ] = $relevant_type;
53
- }
54
-
55
- /** Return modified post types list for Polylang */
56
- return $post_types;
57
 
58
- } // end function
59
 
60
 
61
  add_action( 'parse_query', 'ddw_cpel_polylang_elementor_library_conditions_parse_query', 1 );
@@ -75,14 +71,14 @@ add_action( 'parse_query', 'ddw_cpel_polylang_elementor_library_conditions_parse
75
  */
76
  function ddw_cpel_polylang_elementor_library_conditions_parse_query( $query ) {
77
 
78
- if ( is_admin() && ! empty( $query->query_vars[ 'post_type' ] ) && 'elementor_library' === $query->query_vars[ 'post_type' ]
79
- && ! empty( $query->query_vars[ 'meta_key' ] )
80
- && '_elementor_conditions' === $query->query_vars[ 'meta_key' ]
81
  ) {
82
  $query->set( 'lang', '' );
83
  }
84
 
85
- } // end function
86
 
87
 
88
  add_filter( 'elementor/theme/get_location_templates/template_id', 'ddw_cpel_change_template_based_on_language' );
@@ -103,27 +99,38 @@ function ddw_cpel_change_template_based_on_language( $post_id ) {
103
 
104
  if ( function_exists( 'pll_get_post' ) ) {
105
 
106
- $translation_post_id = pll_get_post( $post_id );
107
 
108
- if ( null === $translation_post_id ) {
109
 
110
- /** The current language is not defined yet */
111
- return $post_id;
112
 
113
- } elseif ( false === $translation_post_id ) {
114
 
115
- /** No translation yet */
116
- return $post_id;
117
 
118
- } elseif ( $translation_post_id > 0 ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
119
 
120
- /** Return translated post ID */
121
- return $translation_post_id;
122
 
123
- } // end if
 
124
 
125
- } // end if
 
126
 
127
- return $post_id;
128
 
129
- } // end function
28
  function ddw_cpel_add_cpts_to_polylang( $post_types, $is_settings ) {
29
 
30
  /** Bail early if integration not wanted */
31
+ if ( ! apply_filters( 'cpel/filter/polylang/posttypes_automatic', true ) ) {
32
  return;
33
  }
34
 
36
  $relevant_types = apply_filters(
37
  'cpel/filter/polylang/post_types',
38
  array(
39
+ 'elementor_library', // Elementor
40
+ 'e-landing-page', // Elementor Landing pages
41
+ 'oceanwp_library', // OceanWP Library
42
+ 'astra-advanced-hook', // Astra Custom Layouts (Astra Pro)
43
+ 'gp_elements', // GeneratePress Elements (GP Premium)
44
+ 'jet-theme-core', // JetThemeCore (Kava Pro/ CrocoBlock)
45
+ 'jet-engine', // JetEngine Listing Item (CrocoBlock)
46
+ 'customify_hook', // Customify (Customify Pro)
47
+ 'wpbf_hooks', // Page Builder Framework Sections (WPBF Premium)
48
+ 'ae_global_templates', // AnyWhere Elementor plugin
49
  )
50
  );
51
 
52
+ return array_merge( $post_types, array_combine( $relevant_types, $relevant_types ) );
 
 
 
 
 
 
53
 
54
+ }
55
 
56
 
57
  add_action( 'parse_query', 'ddw_cpel_polylang_elementor_library_conditions_parse_query', 1 );
71
  */
72
  function ddw_cpel_polylang_elementor_library_conditions_parse_query( $query ) {
73
 
74
+ if ( is_admin() && ! empty( $query->query_vars['post_type'] ) && 'elementor_library' === $query->query_vars['post_type']
75
+ && ! empty( $query->query_vars['meta_key'] )
76
+ && '_elementor_conditions' === $query->query_vars['meta_key']
77
  ) {
78
  $query->set( 'lang', '' );
79
  }
80
 
81
+ }
82
 
83
 
84
  add_filter( 'elementor/theme/get_location_templates/template_id', 'ddw_cpel_change_template_based_on_language' );
99
 
100
  if ( function_exists( 'pll_get_post' ) ) {
101
 
102
+ return pll_get_post( $post_id ) ?: $post_id;
103
 
104
+ }
105
 
106
+ return $post_id;
 
107
 
108
+ }
109
 
 
 
110
 
111
+ add_filter( 'posts_request', 'ddw_cpel_elementor_generate_conditions_on_default_language', 10, 2 );
112
+ /**
113
+ * Ensure Elementor Theme Builder conditions are generated with main language
114
+ *
115
+ * @since 1.0.2
116
+ *
117
+ * @uses pll_current_language()
118
+ * @uses pll_default_language()
119
+ *
120
+ * @param string $request SQL select query
121
+ * @param WP_Query $wp_query Current query
122
+ * @return string updated SQL query
123
+ */
124
+ function ddw_cpel_elementor_generate_conditions_on_default_language( $request, $wp_query ) {
125
 
126
+ if ( function_exists( 'pll_current_language' ) && isset( $wp_query->query['meta_key'] ) && '_elementor_conditions' == $wp_query->query['meta_key'] ) {
 
127
 
128
+ $current_lang = 'term_taxonomy_id IN (' . pll_current_language( 'term_taxonomy_id' ) . ')';
129
+ $default_lang = 'term_taxonomy_id IN (' . pll_default_language( 'term_taxonomy_id' ) . ')';
130
 
131
+ $request = str_replace( $current_lang, $default_lang, $request );
132
+ }
133
 
134
+ return $request;
135
 
136
+ }
modules/dynamic-tags/manager.php CHANGED
@@ -23,16 +23,19 @@ add_action( 'elementor/dynamic_tags/register_tags', 'ddw_cpel_register_dynamic_t
23
  function ddw_cpel_register_dynamic_tags_polylang_languages( $dynamic_tags ) {
24
 
25
  /** Register our tag groups before the tags */
26
- \Elementor\Plugin::$instance->dynamic_tags->register_group( 'polylang-languages', [
27
- 'title' => _x( 'Polylang Languages', 'Elementor Dynamic Tags group title', 'connect-polylang-elementor' )
28
- ] );
 
 
 
29
 
30
  /** Load the Dynamic tags class files */
31
- require_once( CPEL_PLUGIN_DIR . 'modules/dynamic-tags/polylang-language-names.php' );
32
- require_once( CPEL_PLUGIN_DIR . 'modules/dynamic-tags/polylang-current-language-name.php' );
33
- require_once( CPEL_PLUGIN_DIR . 'modules/dynamic-tags/polylang-current-language-code.php' );
34
- require_once( CPEL_PLUGIN_DIR . 'modules/dynamic-tags/polylang-current-language-url.php' );
35
- require_once( CPEL_PLUGIN_DIR . 'modules/dynamic-tags/polylang-current-language-flag.php' );
36
 
37
  /** Register the tags */
38
  $dynamic_tags->register_tag( 'DDW_Polylang_Language_Names_Elementor_Dynamic_Tag' );
@@ -41,4 +44,4 @@ function ddw_cpel_register_dynamic_tags_polylang_languages( $dynamic_tags ) {
41
  $dynamic_tags->register_tag( 'DDW_Polylang_Current_Language_URL_Elementor_Dynamic_Tag' );
42
  $dynamic_tags->register_tag( 'DDW_Polylang_Current_Language_Flag_Elementor_Dynamic_Tag' );
43
 
44
- } // end function
23
  function ddw_cpel_register_dynamic_tags_polylang_languages( $dynamic_tags ) {
24
 
25
  /** Register our tag groups before the tags */
26
+ \Elementor\Plugin::$instance->dynamic_tags->register_group(
27
+ 'polylang-languages',
28
+ array(
29
+ 'title' => _x( 'Polylang Languages', 'Elementor Dynamic Tags group title', 'connect-polylang-elementor' ),
30
+ )
31
+ );
32
 
33
  /** Load the Dynamic tags class files */
34
+ require_once CPEL_PLUGIN_DIR . 'modules/dynamic-tags/polylang-language-names.php';
35
+ require_once CPEL_PLUGIN_DIR . 'modules/dynamic-tags/polylang-current-language-name.php';
36
+ require_once CPEL_PLUGIN_DIR . 'modules/dynamic-tags/polylang-current-language-code.php';
37
+ require_once CPEL_PLUGIN_DIR . 'modules/dynamic-tags/polylang-current-language-url.php';
38
+ require_once CPEL_PLUGIN_DIR . 'modules/dynamic-tags/polylang-current-language-flag.php';
39
 
40
  /** Register the tags */
41
  $dynamic_tags->register_tag( 'DDW_Polylang_Language_Names_Elementor_Dynamic_Tag' );
44
  $dynamic_tags->register_tag( 'DDW_Polylang_Current_Language_URL_Elementor_Dynamic_Tag' );
45
  $dynamic_tags->register_tag( 'DDW_Polylang_Current_Language_Flag_Elementor_Dynamic_Tag' );
46
 
47
+ }
modules/dynamic-tags/polylang-current-language-code.php CHANGED
@@ -15,89 +15,89 @@ if ( ! defined( 'ABSPATH' ) ) {
15
  class DDW_Polylang_Current_Language_Code_Elementor_Dynamic_Tag extends \Elementor\Core\DynamicTags\Tag {
16
 
17
  /**
18
- * Get Name
19
- *
20
- * Returns the Name of the tag
21
- *
22
- * @since 1.0.0
23
- * @access public
24
- *
25
- * @return string
26
- */
27
  public function get_name() {
28
 
29
  return 'current-language-code';
30
 
31
- } // end method
32
 
33
 
34
  /**
35
- * Get Title
36
- *
37
- * Returns the title of the Tag
38
- *
39
- * @since 1.0.0
40
- * @access public
41
- *
42
- * @return string
43
- */
44
  public function get_title() {
45
 
46
  return _x( 'Current Language Code', 'Elementor Dynamic Tag title', 'connect-polylang-elementor' );
47
 
48
- } // end method
49
 
50
 
51
  /**
52
- * Get Group
53
- *
54
- * Returns the Group of the tag
55
- *
56
- * @since 1.0.0
57
- * @access public
58
- *
59
- * @return string
60
- */
61
  public function get_group() {
62
 
63
  return 'polylang-languages';
64
 
65
- } // end method
66
 
67
 
68
  /**
69
- * Get Categories
70
- *
71
- * Returns an array of tag categories
72
- *
73
- * @since 1.0.0
74
- * @access public
75
- *
76
- * @return array
77
- */
78
  public function get_categories() {
79
 
80
- return [ \Elementor\Modules\DynamicTags\Module::TEXT_CATEGORY ];
81
 
82
- } // end method
83
 
84
 
85
  /**
86
- * Render
87
- *
88
- * Prints out the value of the Dynamic tag
89
- *
90
- * @since 1.0.0
91
- * @access public
92
- *
93
- * @uses pll_current_language()
94
- *
95
- * @return void
96
- */
97
  public function render() {
98
-
99
  echo wp_kses_post( pll_current_language( $field = 'slug' ) );
100
 
101
- } // end method
102
 
103
- } // end of class
15
  class DDW_Polylang_Current_Language_Code_Elementor_Dynamic_Tag extends \Elementor\Core\DynamicTags\Tag {
16
 
17
  /**
18
+ * Get Name
19
+ *
20
+ * Returns the Name of the tag
21
+ *
22
+ * @since 1.0.0
23
+ * @access public
24
+ *
25
+ * @return string
26
+ */
27
  public function get_name() {
28
 
29
  return 'current-language-code';
30
 
31
+ }
32
 
33
 
34
  /**
35
+ * Get Title
36
+ *
37
+ * Returns the title of the Tag
38
+ *
39
+ * @since 1.0.0
40
+ * @access public
41
+ *
42
+ * @return string
43
+ */
44
  public function get_title() {
45
 
46
  return _x( 'Current Language Code', 'Elementor Dynamic Tag title', 'connect-polylang-elementor' );
47
 
48
+ }
49
 
50
 
51
  /**
52
+ * Get Group
53
+ *
54
+ * Returns the Group of the tag
55
+ *
56
+ * @since 1.0.0
57
+ * @access public
58
+ *
59
+ * @return string
60
+ */
61
  public function get_group() {
62
 
63
  return 'polylang-languages';
64
 
65
+ }
66
 
67
 
68
  /**
69
+ * Get Categories
70
+ *
71
+ * Returns an array of tag categories
72
+ *
73
+ * @since 1.0.0
74
+ * @access public
75
+ *
76
+ * @return array
77
+ */
78
  public function get_categories() {
79
 
80
+ return array( \Elementor\Modules\DynamicTags\Module::TEXT_CATEGORY );
81
 
82
+ }
83
 
84
 
85
  /**
86
+ * Render
87
+ *
88
+ * Prints out the value of the Dynamic tag
89
+ *
90
+ * @since 1.0.0
91
+ * @access public
92
+ *
93
+ * @uses pll_current_language()
94
+ *
95
+ * @return void
96
+ */
97
  public function render() {
98
+
99
  echo wp_kses_post( pll_current_language( $field = 'slug' ) );
100
 
101
+ }
102
 
103
+ }
modules/dynamic-tags/polylang-current-language-flag.php CHANGED
@@ -15,94 +15,94 @@ if ( ! defined( 'ABSPATH' ) ) {
15
  class DDW_Polylang_Current_Language_Flag_Elementor_Dynamic_Tag extends \Elementor\Core\DynamicTags\Data_Tag {
16
 
17
  /**
18
- * Get Name
19
- *
20
- * Returns the Name of the tag
21
- *
22
- * @since 1.0.0
23
- * @access public
24
- *
25
- * @return string
26
- */
27
  public function get_name() {
28
 
29
  return 'current-language-flag';
30
 
31
- } // end method
32
 
33
 
34
  /**
35
- * Get Title
36
- *
37
- * Returns the title of the Tag
38
- *
39
- * @since 1.0.0
40
- * @access public
41
- *
42
- * @return string
43
- */
44
  public function get_title() {
45
 
46
  return _x( 'Current Language Flag', 'Elementor Dynamic Tag title', 'connect-polylang-elementor' );
47
 
48
- } // end method
49
 
50
 
51
  /**
52
- * Get Group
53
- *
54
- * Returns the Group of the tag
55
- *
56
- * @since 1.0.0
57
- * @access public
58
- *
59
- * @return string
60
- */
61
  public function get_group() {
62
 
63
  return 'polylang-languages';
64
 
65
- } // end method
66
 
67
 
68
  /**
69
- * Get Categories
70
- *
71
- * Returns an array of tag categories
72
- *
73
- * @since 1.0.0
74
- * @access public
75
- *
76
- * @return array
77
- */
78
  public function get_categories() {
79
 
80
- return [ \Elementor\Modules\DynamicTags\Module::IMAGE_CATEGORY ];
81
 
82
- } // end method
83
 
84
 
85
  /**
86
- * Render
87
- *
88
- * Prints out the value of the Dynamic tag
89
- *
90
- * @since 1.0.0
91
- * @access public
92
- *
93
- * @uses pll_current_language()
94
- *
95
- * @return void
96
- */
97
- public function get_value( array $options = [] ) {
98
-
99
- $image_data = [
100
  'id' => (int) pll_current_language( $field = 'term_id' ),
101
  'url' => pll_current_language( $field = 'flag_url' ),
102
- ];
103
 
104
  return $image_data;
105
 
106
- } // end method
107
 
108
- } // end of class
15
  class DDW_Polylang_Current_Language_Flag_Elementor_Dynamic_Tag extends \Elementor\Core\DynamicTags\Data_Tag {
16
 
17
  /**
18
+ * Get Name
19
+ *
20
+ * Returns the Name of the tag
21
+ *
22
+ * @since 1.0.0
23
+ * @access public
24
+ *
25
+ * @return string
26
+ */
27
  public function get_name() {
28
 
29
  return 'current-language-flag';
30
 
31
+ }
32
 
33
 
34
  /**
35
+ * Get Title
36
+ *
37
+ * Returns the title of the Tag
38
+ *
39
+ * @since 1.0.0
40
+ * @access public
41
+ *
42
+ * @return string
43
+ */
44
  public function get_title() {
45
 
46
  return _x( 'Current Language Flag', 'Elementor Dynamic Tag title', 'connect-polylang-elementor' );
47
 
48
+ }
49
 
50
 
51
  /**
52
+ * Get Group
53
+ *
54
+ * Returns the Group of the tag
55
+ *
56
+ * @since 1.0.0
57
+ * @access public
58
+ *
59
+ * @return string
60
+ */
61
  public function get_group() {
62
 
63
  return 'polylang-languages';
64
 
65
+ }
66
 
67
 
68
  /**
69
+ * Get Categories
70
+ *
71
+ * Returns an array of tag categories
72
+ *
73
+ * @since 1.0.0
74
+ * @access public
75
+ *
76
+ * @return array
77
+ */
78
  public function get_categories() {
79
 
80
+ return array( \Elementor\Modules\DynamicTags\Module::IMAGE_CATEGORY );
81
 
82
+ }
83
 
84
 
85
  /**
86
+ * Render
87
+ *
88
+ * Prints out the value of the Dynamic tag
89
+ *
90
+ * @since 1.0.0
91
+ * @access public
92
+ *
93
+ * @uses pll_current_language()
94
+ *
95
+ * @return void
96
+ */
97
+ public function get_value( array $options = array() ) {
98
+
99
+ $image_data = array(
100
  'id' => (int) pll_current_language( $field = 'term_id' ),
101
  'url' => pll_current_language( $field = 'flag_url' ),
102
+ );
103
 
104
  return $image_data;
105
 
106
+ }
107
 
108
+ }
modules/dynamic-tags/polylang-current-language-name.php CHANGED
@@ -15,89 +15,89 @@ if ( ! defined( 'ABSPATH' ) ) {
15
  class DDW_Polylang_Current_Language_Name_Elementor_Dynamic_Tag extends \Elementor\Core\DynamicTags\Tag {
16
 
17
  /**
18
- * Get Name
19
- *
20
- * Returns the Name of the tag
21
- *
22
- * @since 1.0.0
23
- * @access public
24
- *
25
- * @return string
26
- */
27
  public function get_name() {
28
 
29
  return 'current-language-name';
30
 
31
- } // end method
32
 
33
 
34
  /**
35
- * Get Title
36
- *
37
- * Returns the title of the Tag
38
- *
39
- * @since 1.0.0
40
- * @access public
41
- *
42
- * @return string
43
- */
44
  public function get_title() {
45
 
46
  return _x( 'Current Language Name', 'Elementor Dynamic Tag title', 'connect-polylang-elementor' );
47
 
48
- } // end method
49
 
50
 
51
  /**
52
- * Get Group
53
- *
54
- * Returns the Group of the tag
55
- *
56
- * @since 1.0.0
57
- * @access public
58
- *
59
- * @return string
60
- */
61
  public function get_group() {
62
 
63
  return 'polylang-languages';
64
 
65
- } // end method
66
 
67
 
68
  /**
69
- * Get Categories
70
- *
71
- * Returns an array of tag categories
72
- *
73
- * @since 1.0.0
74
- * @access public
75
- *
76
- * @return array
77
- */
78
  public function get_categories() {
79
 
80
- return [ \Elementor\Modules\DynamicTags\Module::TEXT_CATEGORY ];
81
 
82
- } // end method
83
 
84
 
85
  /**
86
- * Render
87
- *
88
- * Prints out the value of the Dynamic tag
89
- *
90
- * @since 1.0.0
91
- * @access public
92
- *
93
- * @uses pll_current_language()
94
- *
95
- * @return void
96
- */
97
  public function render() {
98
-
99
  echo wp_kses_post( pll_current_language( $field = 'name' ) );
100
 
101
- } // end method
102
 
103
- } // end of class
15
  class DDW_Polylang_Current_Language_Name_Elementor_Dynamic_Tag extends \Elementor\Core\DynamicTags\Tag {
16
 
17
  /**
18
+ * Get Name
19
+ *
20
+ * Returns the Name of the tag
21
+ *
22
+ * @since 1.0.0
23
+ * @access public
24
+ *
25
+ * @return string
26
+ */
27
  public function get_name() {
28
 
29
  return 'current-language-name';
30
 
31
+ }
32
 
33
 
34
  /**
35
+ * Get Title
36
+ *
37
+ * Returns the title of the Tag
38
+ *
39
+ * @since 1.0.0
40
+ * @access public
41
+ *
42
+ * @return string
43
+ */
44
  public function get_title() {
45
 
46
  return _x( 'Current Language Name', 'Elementor Dynamic Tag title', 'connect-polylang-elementor' );
47
 
48
+ }
49
 
50
 
51
  /**
52
+ * Get Group
53
+ *
54
+ * Returns the Group of the tag
55
+ *
56
+ * @since 1.0.0
57
+ * @access public
58
+ *
59
+ * @return string
60
+ */
61
  public function get_group() {
62
 
63
  return 'polylang-languages';
64
 
65
+ }
66
 
67
 
68
  /**
69
+ * Get Categories
70
+ *
71
+ * Returns an array of tag categories
72
+ *
73
+ * @since 1.0.0
74
+ * @access public
75
+ *
76
+ * @return array
77
+ */
78
  public function get_categories() {
79
 
80
+ return array( \Elementor\Modules\DynamicTags\Module::TEXT_CATEGORY );
81
 
82
+ }
83
 
84
 
85
  /**
86
+ * Render
87
+ *
88
+ * Prints out the value of the Dynamic tag
89
+ *
90
+ * @since 1.0.0
91
+ * @access public
92
+ *
93
+ * @uses pll_current_language()
94
+ *
95
+ * @return void
96
+ */
97
  public function render() {
98
+
99
  echo wp_kses_post( pll_current_language( $field = 'name' ) );
100
 
101
+ }
102
 
103
+ }
modules/dynamic-tags/polylang-current-language-url.php CHANGED
@@ -15,87 +15,87 @@ if ( ! defined( 'ABSPATH' ) ) {
15
  class DDW_Polylang_Current_Language_URL_Elementor_Dynamic_Tag extends \Elementor\Core\DynamicTags\Data_Tag {
16
 
17
  /**
18
- * Get Name
19
- *
20
- * Returns the Name of the tag
21
- *
22
- * @since 1.0.0
23
- * @access public
24
- *
25
- * @return string
26
- */
27
  public function get_name() {
28
 
29
  return 'current-language-url';
30
 
31
- } // end method
32
 
33
 
34
  /**
35
- * Get Title
36
- *
37
- * Returns the title of the Tag
38
- *
39
- * @since 1.0.0
40
- * @access public
41
- *
42
- * @return string
43
- */
44
  public function get_title() {
45
 
46
  return _x( 'Current Language URL', 'Elementor Dynamic Tag title', 'connect-polylang-elementor' );
47
 
48
- } // end method
49
 
50
 
51
  /**
52
- * Get Group
53
- *
54
- * Returns the Group of the tag
55
- *
56
- * @since 1.0.0
57
- * @access public
58
- *
59
- * @return string
60
- */
61
  public function get_group() {
62
 
63
  return 'polylang-languages';
64
 
65
- } // end method
66
 
67
 
68
  /**
69
- * Get Categories
70
- *
71
- * Returns an array of tag categories
72
- *
73
- * @since 1.0.0
74
- * @access public
75
- *
76
- * @return array
77
- */
78
  public function get_categories() {
79
 
80
- return [ \Elementor\Modules\DynamicTags\Module::URL_CATEGORY ];
81
 
82
- } // end method
83
 
84
 
85
  /**
86
- * Render
87
- *
88
- * Prints out the value of the Dynamic tag
89
- *
90
- * @since 1.0.0
91
- * @access public
92
- *
93
- * @uses pll_the_languages()
94
- *
95
- * @return void
96
- */
97
- public function get_value( array $options = [] ) {
98
-
99
  /** Get all Polylang languages */
100
  $languages = pll_the_languages( array( 'raw' => 1 ) );
101
 
@@ -104,16 +104,14 @@ class DDW_Polylang_Current_Language_URL_Elementor_Dynamic_Tag extends \Elementor
104
  foreach ( $languages as $language ) {
105
 
106
  /** If current language found, stop the loop */
107
- if ( $language[ 'current_lang' ] ) {
108
  break;
109
  }
110
-
111
  } // end foreach
 
112
 
113
- } // end if
114
 
115
- return esc_url_raw( $language[ 'url' ] );
116
 
117
- } // end method
118
-
119
- } // end of class
15
  class DDW_Polylang_Current_Language_URL_Elementor_Dynamic_Tag extends \Elementor\Core\DynamicTags\Data_Tag {
16
 
17
  /**
18
+ * Get Name
19
+ *
20
+ * Returns the Name of the tag
21
+ *
22
+ * @since 1.0.0
23
+ * @access public
24
+ *
25
+ * @return string
26
+ */
27
  public function get_name() {
28
 
29
  return 'current-language-url';
30
 
31
+ }
32
 
33
 
34
  /**
35
+ * Get Title
36
+ *
37
+ * Returns the title of the Tag
38
+ *
39
+ * @since 1.0.0
40
+ * @access public
41
+ *
42
+ * @return string
43
+ */
44
  public function get_title() {
45
 
46
  return _x( 'Current Language URL', 'Elementor Dynamic Tag title', 'connect-polylang-elementor' );
47
 
48
+ }
49
 
50
 
51
  /**
52
+ * Get Group
53
+ *
54
+ * Returns the Group of the tag
55
+ *
56
+ * @since 1.0.0
57
+ * @access public
58
+ *
59
+ * @return string
60
+ */
61
  public function get_group() {
62
 
63
  return 'polylang-languages';
64
 
65
+ }
66
 
67
 
68
  /**
69
+ * Get Categories
70
+ *
71
+ * Returns an array of tag categories
72
+ *
73
+ * @since 1.0.0
74
+ * @access public
75
+ *
76
+ * @return array
77
+ */
78
  public function get_categories() {
79
 
80
+ return array( \Elementor\Modules\DynamicTags\Module::URL_CATEGORY );
81
 
82
+ }
83
 
84
 
85
  /**
86
+ * Render
87
+ *
88
+ * Prints out the value of the Dynamic tag
89
+ *
90
+ * @since 1.0.0
91
+ * @access public
92
+ *
93
+ * @uses pll_the_languages()
94
+ *
95
+ * @return void
96
+ */
97
+ public function get_value( array $options = array() ) {
98
+
99
  /** Get all Polylang languages */
100
  $languages = pll_the_languages( array( 'raw' => 1 ) );
101
 
104
  foreach ( $languages as $language ) {
105
 
106
  /** If current language found, stop the loop */
107
+ if ( $language['current_lang'] ) {
108
  break;
109
  }
 
110
  } // end foreach
111
+ }
112
 
113
+ return esc_url_raw( $language['url'] );
114
 
115
+ }
116
 
117
+ }
 
 
modules/dynamic-tags/polylang-language-names.php CHANGED
@@ -15,90 +15,90 @@ if ( ! defined( 'ABSPATH' ) ) {
15
  class DDW_Polylang_Language_Names_Elementor_Dynamic_Tag extends \Elementor\Core\DynamicTags\Tag {
16
 
17
  /**
18
- * Get Name
19
- *
20
- * Returns the Name of the tag
21
- *
22
- * @since 1.0.0
23
- * @access public
24
- *
25
- * @return string
26
- */
27
  public function get_name() {
28
 
29
  return 'language-names';
30
 
31
- } // end method
32
 
33
 
34
  /**
35
- * Get Title
36
- *
37
- * Returns the title of the Tag
38
- *
39
- * @since 1.0.0
40
- * @access public
41
- *
42
- * @return string
43
- */
44
  public function get_title() {
45
 
46
  return _x( 'Language Names', 'Elementor Dynamic Tag title', 'connect-polylang-elementor' );
47
 
48
- } // end method
49
 
50
 
51
  /**
52
- * Get Group
53
- *
54
- * Returns the Group of the tag
55
- *
56
- * @since 1.0.0
57
- * @access public
58
- *
59
- * @return string
60
- */
61
  public function get_group() {
62
 
63
  return 'polylang-languages';
64
 
65
- } // end method
66
 
67
 
68
  /**
69
- * Get Categories
70
- *
71
- * Returns an array of tag categories
72
- *
73
- * @since 1.0.0
74
- * @access public
75
- *
76
- * @return array
77
- */
78
  public function get_categories() {
79
 
80
- return [ \Elementor\Modules\DynamicTags\Module::TEXT_CATEGORY ];
81
 
82
- } // end method
83
 
84
 
85
  /**
86
- * Register Controls
87
- *
88
- * Registers the Dynamic tag controls
89
- *
90
- * @since 1.0.0
91
- * @access protected
92
- *
93
- * @uses pll_languages_list()
94
- *
95
- * @return void
96
- */
97
  protected function _register_controls() {
98
 
99
- $languages = pll_languages_list( array( 'fields' => FALSE ) );
100
 
101
- $lang_names = [];
102
 
103
  foreach ( $languages as $language ) {
104
  $lang_names[ $language->name ] = $language->name;
@@ -106,36 +106,36 @@ class DDW_Polylang_Language_Names_Elementor_Dynamic_Tag extends \Elementor\Core\
106
 
107
  $this->add_control(
108
  'polylang_language_name',
109
- [
110
  'label' => __( 'Language Name', 'connect-polylang-elementor' ),
111
  'type' => \Elementor\Controls_Manager::SELECT,
112
  'options' => $lang_names,
113
- ]
114
  );
115
 
116
- } // end method
117
 
118
 
119
  /**
120
- * Render
121
- *
122
- * Prints out the value of the Dynamic tag
123
- *
124
- * @since 1.0.0
125
- * @access public
126
- *
127
- * @return void
128
- */
129
  public function render() {
130
 
131
  $lang_name = $this->get_settings( 'polylang_language_name' );
132
 
133
- if ( ! $lang_name ) {
134
  return;
135
  }
136
-
137
  echo esc_attr( $lang_name );
138
 
139
- } // end method
140
 
141
- } // end of class
15
  class DDW_Polylang_Language_Names_Elementor_Dynamic_Tag extends \Elementor\Core\DynamicTags\Tag {
16
 
17
  /**
18
+ * Get Name
19
+ *
20
+ * Returns the Name of the tag
21
+ *
22
+ * @since 1.0.0
23
+ * @access public
24
+ *
25
+ * @return string
26
+ */
27
  public function get_name() {
28
 
29
  return 'language-names';
30
 
31
+ }
32
 
33
 
34
  /**
35
+ * Get Title
36
+ *
37
+ * Returns the title of the Tag
38
+ *
39
+ * @since 1.0.0
40
+ * @access public
41
+ *
42
+ * @return string
43
+ */
44
  public function get_title() {
45
 
46
  return _x( 'Language Names', 'Elementor Dynamic Tag title', 'connect-polylang-elementor' );
47
 
48
+ }
49
 
50
 
51
  /**
52
+ * Get Group
53
+ *
54
+ * Returns the Group of the tag
55
+ *
56
+ * @since 1.0.0
57
+ * @access public
58
+ *
59
+ * @return string
60
+ */
61
  public function get_group() {
62
 
63
  return 'polylang-languages';
64
 
65
+ }
66
 
67
 
68
  /**
69
+ * Get Categories
70
+ *
71
+ * Returns an array of tag categories
72
+ *
73
+ * @since 1.0.0
74
+ * @access public
75
+ *
76
+ * @return array
77
+ */
78
  public function get_categories() {
79
 
80
+ return array( \Elementor\Modules\DynamicTags\Module::TEXT_CATEGORY );
81
 
82
+ }
83
 
84
 
85
  /**
86
+ * Register Controls
87
+ *
88
+ * Registers the Dynamic tag controls
89
+ *
90
+ * @since 1.0.0
91
+ * @access protected
92
+ *
93
+ * @uses pll_languages_list()
94
+ *
95
+ * @return void
96
+ */
97
  protected function _register_controls() {
98
 
99
+ $languages = pll_languages_list( array( 'fields' => false ) );
100
 
101
+ $lang_names = array();
102
 
103
  foreach ( $languages as $language ) {
104
  $lang_names[ $language->name ] = $language->name;
106
 
107
  $this->add_control(
108
  'polylang_language_name',
109
+ array(
110
  'label' => __( 'Language Name', 'connect-polylang-elementor' ),
111
  'type' => \Elementor\Controls_Manager::SELECT,
112
  'options' => $lang_names,
113
+ )
114
  );
115
 
116
+ }
117
 
118
 
119
  /**
120
+ * Render
121
+ *
122
+ * Prints out the value of the Dynamic tag
123
+ *
124
+ * @since 1.0.0
125
+ * @access public
126
+ *
127
+ * @return void
128
+ */
129
  public function render() {
130
 
131
  $lang_name = $this->get_settings( 'polylang_language_name' );
132
 
133
+ if ( ! $lang_name ) {
134
  return;
135
  }
136
+
137
  echo esc_attr( $lang_name );
138
 
139
+ }
140
 
141
+ }
modules/finder/manager.php CHANGED
@@ -25,8 +25,8 @@ add_action( 'elementor/finder/categories/init', 'ddw_cpel_elementor_finder_add_i
25
  function ddw_cpel_elementor_finder_add_items( $categories_manager ) {
26
 
27
  /** Include the Finder Category class files */
28
- require_once( CPEL_PLUGIN_DIR . 'modules/finder/plugin-polylang.php' );
29
- require_once( CPEL_PLUGIN_DIR . 'modules/finder/plugin-cpel.php' );
30
 
31
  /** Add the Polyang Plugin category */
32
  $categories_manager->add_category( 'polylang-plugin', new DDW_Polylang_Plugin_Finder_Category() );
@@ -34,4 +34,4 @@ function ddw_cpel_elementor_finder_add_items( $categories_manager ) {
34
  /** Add the our own CPEL Plugin category */
35
  $categories_manager->add_category( 'connect-polylang-elementor', new DDW_CPEL_Plugin_Finder_Category() );
36
 
37
- } // end function
25
  function ddw_cpel_elementor_finder_add_items( $categories_manager ) {
26
 
27
  /** Include the Finder Category class files */
28
+ require_once CPEL_PLUGIN_DIR . 'modules/finder/plugin-polylang.php';
29
+ require_once CPEL_PLUGIN_DIR . 'modules/finder/plugin-cpel.php';
30
 
31
  /** Add the Polyang Plugin category */
32
  $categories_manager->add_category( 'polylang-plugin', new DDW_Polylang_Plugin_Finder_Category() );
34
  /** Add the our own CPEL Plugin category */
35
  $categories_manager->add_category( 'connect-polylang-elementor', new DDW_CPEL_Plugin_Finder_Category() );
36
 
37
+ }
modules/finder/plugin-cpel.php CHANGED
@@ -33,7 +33,7 @@ class DDW_CPEL_Plugin_Finder_Category extends \Elementor\Core\Common\Modules\Fin
33
 
34
  return _x( 'Add-On: Polylang Connect for Elementor', 'Category title in Elementor Finder', 'connect-polylang-elementor' );
35
 
36
- } // end method
37
 
38
 
39
  /**
@@ -48,59 +48,59 @@ class DDW_CPEL_Plugin_Finder_Category extends \Elementor\Core\Common\Modules\Fin
48
  * @param array $options
49
  * @return array $items Filterable array of additional Finder items.
50
  */
51
- public function get_category_items( array $options = [] ) {
52
 
53
  /** Set actions */
54
  $action_name = 'view';
55
  $action_icon = 'eye';
56
 
57
  /** External: FAQ */
58
- $items[ 'plugin-faq' ] = [
59
  'title' => _x( 'Plugin FAQ', 'Title in Elementor Finder', 'connect-polylang-elementor' ),
60
  'url' => ddw_cpel_get_info_url( 'url_wporg_faq' ),
61
  'icon' => 'info',
62
- 'keywords' => [ 'help', 'docs', 'documentation', 'faq', 'knowledge base', 'plugin' ],
63
  'description' => __( 'FAQ and Documentation', 'connect-polylang-elementor' ),
64
- 'actions' => [
65
- [
66
  'name' => $action_name,
67
  'url' => ddw_cpel_get_info_url( 'url_wporg_faq' ),
68
  'icon' => $action_icon,
69
- ],
70
- ],
71
- ];
72
 
73
  /** External: WordPress.org support forum */
74
- $items[ 'plugin-support-forum' ] = [
75
  'title' => _x( 'Plugin Support Forum', 'Title in Elementor Finder', 'connect-polylang-elementor' ),
76
  'url' => ddw_cpel_get_info_url( 'url_wporg_forum' ),
77
  'icon' => 'comments',
78
- 'keywords' => [ 'support', 'forum', 'wordpress.org', 'help', 'plugin' ],
79
  'description' => __( 'Free support on WordPress.org', 'connect-polylang-elementor' ),
80
- 'actions' => [
81
- [
82
  'name' => $action_name,
83
  'url' => ddw_cpel_get_info_url( 'url_wporg_forum' ),
84
  'icon' => $action_icon,
85
- ],
86
- ],
87
- ];
88
 
89
  /** External: WordPress.org translation platform */
90
- $items[ 'plugin-translations' ] = [
91
  'title' => _x( 'Plugin Translations', 'Title in Elementor Finder', 'connect-polylang-elementor' ),
92
  'url' => ddw_cpel_get_info_url( 'url_translate' ),
93
  'icon' => 'exchange',
94
- 'keywords' => [ 'translate', 'translations', 'wordpress.org', 'glotpress', 'plugin' ],
95
  'description' => __( 'Translate this plugin on WordPress.org', 'connect-polylang-elementor' ),
96
- 'actions' => [
97
- [
98
  'name' => $action_name,
99
  'url' => ddw_cpel_get_info_url( 'url_translate' ),
100
  'icon' => $action_icon,
101
- ],
102
- ],
103
- ];
104
 
105
  /** Return items array, filterable */
106
  return apply_filters(
@@ -108,6 +108,6 @@ class DDW_CPEL_Plugin_Finder_Category extends \Elementor\Core\Common\Modules\Fin
108
  $items
109
  );
110
 
111
- } // end method
112
 
113
- } // end of class
33
 
34
  return _x( 'Add-On: Polylang Connect for Elementor', 'Category title in Elementor Finder', 'connect-polylang-elementor' );
35
 
36
+ }
37
 
38
 
39
  /**
48
  * @param array $options
49
  * @return array $items Filterable array of additional Finder items.
50
  */
51
+ public function get_category_items( array $options = array() ) {
52
 
53
  /** Set actions */
54
  $action_name = 'view';
55
  $action_icon = 'eye';
56
 
57
  /** External: FAQ */
58
+ $items['plugin-faq'] = array(
59
  'title' => _x( 'Plugin FAQ', 'Title in Elementor Finder', 'connect-polylang-elementor' ),
60
  'url' => ddw_cpel_get_info_url( 'url_wporg_faq' ),
61
  'icon' => 'info',
62
+ 'keywords' => array( 'help', 'docs', 'documentation', 'faq', 'knowledge base', 'plugin' ),
63
  'description' => __( 'FAQ and Documentation', 'connect-polylang-elementor' ),
64
+ 'actions' => array(
65
+ array(
66
  'name' => $action_name,
67
  'url' => ddw_cpel_get_info_url( 'url_wporg_faq' ),
68
  'icon' => $action_icon,
69
+ ),
70
+ ),
71
+ );
72
 
73
  /** External: WordPress.org support forum */
74
+ $items['plugin-support-forum'] = array(
75
  'title' => _x( 'Plugin Support Forum', 'Title in Elementor Finder', 'connect-polylang-elementor' ),
76
  'url' => ddw_cpel_get_info_url( 'url_wporg_forum' ),
77
  'icon' => 'comments',
78
+ 'keywords' => array( 'support', 'forum', 'wordpress.org', 'help', 'plugin' ),
79
  'description' => __( 'Free support on WordPress.org', 'connect-polylang-elementor' ),
80
+ 'actions' => array(
81
+ array(
82
  'name' => $action_name,
83
  'url' => ddw_cpel_get_info_url( 'url_wporg_forum' ),
84
  'icon' => $action_icon,
85
+ ),
86
+ ),
87
+ );
88
 
89
  /** External: WordPress.org translation platform */
90
+ $items['plugin-translations'] = array(
91
  'title' => _x( 'Plugin Translations', 'Title in Elementor Finder', 'connect-polylang-elementor' ),
92
  'url' => ddw_cpel_get_info_url( 'url_translate' ),
93
  'icon' => 'exchange',
94
+ 'keywords' => array( 'translate', 'translations', 'wordpress.org', 'glotpress', 'plugin' ),
95
  'description' => __( 'Translate this plugin on WordPress.org', 'connect-polylang-elementor' ),
96
+ 'actions' => array(
97
+ array(
98
  'name' => $action_name,
99
  'url' => ddw_cpel_get_info_url( 'url_translate' ),
100
  'icon' => $action_icon,
101
+ ),
102
+ ),
103
+ );
104
 
105
  /** Return items array, filterable */
106
  return apply_filters(
108
  $items
109
  );
110
 
111
+ }
112
 
113
+ }
modules/finder/plugin-polylang.php CHANGED
@@ -34,7 +34,7 @@ class DDW_Polylang_Plugin_Finder_Category extends \Elementor\Core\Common\Modules
34
 
35
  return _x( 'Polylang - Multilingual Plugin', 'Category title in Elementor Finder', 'connect-polylang-elementor' );
36
 
37
- } // end method
38
 
39
 
40
  /**
@@ -50,7 +50,7 @@ class DDW_Polylang_Plugin_Finder_Category extends \Elementor\Core\Common\Modules
50
  * @param array $options
51
  * @return array $items Filterable array of additional Finder items.
52
  */
53
- public function get_category_items( array $options = [] ) {
54
 
55
  /** Set "Polylang (Pro)" string */
56
  $string_polylang = _x( 'Polylang', 'Item title part in Elementor Finder', 'connect-polylang-elementor' ) . ': ';
@@ -79,116 +79,116 @@ class DDW_Polylang_Plugin_Finder_Category extends \Elementor\Core\Common\Modules
79
 
80
  foreach ( $languages as $lang_data ) {
81
 
82
- $items[ 'website-language-' . $lang_data->slug ] = [
83
  'title' => $string_website_lang . $lang_data->name,
84
  'url' => esc_url( $lang_data->home_url ),
85
  'icon' => 'eye',
86
- 'keywords' => [
87
  'website',
88
  'polylang',
89
  'language',
90
  $lang_data->name,
91
  $lang_data->slug,
92
  'country',
93
- $lang_data->locale
94
- ],
95
  'description' => __( 'View website in this language', 'connect-polylang-elementor' ),
96
- 'actions' => [
97
- [
98
  'name' => 'edit',
99
  'url' => esc_url_raw( admin_url( 'admin.php?page=mlang&pll_action=edit&lang=' . $lang_data->term_id ) ),
100
  'icon' => 'edit',
101
- ],
102
- ],
103
- ];
104
 
105
  } // end foreach
106
 
107
  foreach ( $languages as $lang_data ) {
108
 
109
- $items[ 'polylang-language-' . $lang_data->slug ] = [
110
  'title' => $string_polylang_lang . $lang_data->name,
111
  'url' => esc_url_raw( admin_url( 'admin.php?page=mlang&pll_action=edit&lang=' . $lang_data->term_id ) ),
112
  'icon' => 'edit',
113
- 'keywords' => [
114
  'polylang',
115
  'language',
116
  $lang_data->name,
117
  $lang_data->slug,
118
  'country',
119
- $lang_data->locale
120
- ],
121
  'description' => __( 'Edit this language', 'connect-polylang-elementor' ),
122
- 'actions' => [
123
- [
124
  'name' => $action_name,
125
  'url' => esc_url( $lang_data->home_url ),
126
  'icon' => $action_icon,
127
- ],
128
- ],
129
- ];
130
 
131
  } // end foreach
132
  }
133
 
134
  /** Settings: Languages setup */
135
- $items[ 'languages' ] = [
136
  'title' => $string_polylang . _x( 'Setup languages', 'Title in Elementor Finder', 'connect-polylang-elementor' ),
137
  'url' => admin_url( 'admin.php?page=mlang' ),
138
  'icon' => 'comments',
139
- 'keywords' => [ 'polylang', 'languages', 'setup', 'flags', 'country', 'countries' ],
140
  'description' => __( 'All languages your website appears in', 'connect-polylang-elementor' ),
141
- ];
142
 
143
  /** Settings: String translations */
144
- $items[ 'string-translations' ] = [
145
  'title' => $string_polylang . _x( 'String Translations', 'Title in Elementor Finder', 'connect-polylang-elementor' ),
146
  'url' => admin_url( 'admin.php?page=mlang_strings' ),
147
  'icon' => 'exchange',
148
- 'keywords' => [ 'polylang', 'translations', 'translate', 'strings' ],
149
  'description' => __( 'From Widgets and other website parts', 'connect-polylang-elementor' ),
150
- ];
151
 
152
  /** Settings: General, for plugin */
153
- $items[ 'settings' ] = [
154
  'title' => $string_polylang . _x( 'Settings', 'Title in Elementor Finder', 'connect-polylang-elementor' ),
155
  'url' => admin_url( 'admin.php?page=mlang_settings' ),
156
  'icon' => 'settings',
157
- 'keywords' => [ 'polylang', 'settings', 'options', 'modules' ],
158
  'description' => __( 'Plugin\'s settings, enable/ disable modules', 'connect-polylang-elementor' ),
159
- ];
160
 
161
  /** External: documentation */
162
- $items[ 'documentation' ] = [
163
  'title' => $string_polylang . _x( 'Plugin Documentation', 'Title in Elementor Finder', 'connect-polylang-elementor' ),
164
  'url' => 'https://polylang.pro/doc/',
165
  'icon' => 'info',
166
- 'keywords' => [ 'help', 'support', 'docs', 'documentation', 'faq', 'knowledge base' ],
167
  'description' => __( 'FAQ, Knowledge Base and Documentation', 'connect-polylang-elementor' ),
168
- 'actions' => [
169
- [
170
  'name' => $action_name,
171
  'url' => 'https://polylang.pro/doc/',
172
  'icon' => $action_icon,
173
- ],
174
- ],
175
- ];
176
 
177
  /** External: WordPress.org support forum */
178
- $items[ 'support-forum' ] = [
179
  'title' => $string_polylang . _x( 'Support Forum', 'Title in Elementor Finder', 'connect-polylang-elementor' ),
180
  'url' => 'https://wordpress.org/support/plugin/polylang',
181
  'icon' => 'comments',
182
- 'keywords' => [ 'support', 'forum', 'wordpress.org', 'help' ],
183
  'description' => __( 'Free support on WordPress.org', 'connect-polylang-elementor' ),
184
- 'actions' => [
185
- [
186
  'name' => $action_name,
187
  'url' => 'https://wordpress.org/support/plugin/polylang',
188
  'icon' => $action_icon,
189
- ],
190
- ],
191
- ];
192
 
193
  /** Return items array, filterable */
194
  return apply_filters(
@@ -196,6 +196,6 @@ class DDW_Polylang_Plugin_Finder_Category extends \Elementor\Core\Common\Modules
196
  $items
197
  );
198
 
199
- } // end method
200
 
201
- } // end of class
34
 
35
  return _x( 'Polylang - Multilingual Plugin', 'Category title in Elementor Finder', 'connect-polylang-elementor' );
36
 
37
+ }
38
 
39
 
40
  /**
50
  * @param array $options
51
  * @return array $items Filterable array of additional Finder items.
52
  */
53
+ public function get_category_items( array $options = array() ) {
54
 
55
  /** Set "Polylang (Pro)" string */
56
  $string_polylang = _x( 'Polylang', 'Item title part in Elementor Finder', 'connect-polylang-elementor' ) . ': ';
79
 
80
  foreach ( $languages as $lang_data ) {
81
 
82
+ $items[ 'website-language-' . $lang_data->slug ] = array(
83
  'title' => $string_website_lang . $lang_data->name,
84
  'url' => esc_url( $lang_data->home_url ),
85
  'icon' => 'eye',
86
+ 'keywords' => array(
87
  'website',
88
  'polylang',
89
  'language',
90
  $lang_data->name,
91
  $lang_data->slug,
92
  'country',
93
+ $lang_data->locale,
94
+ ),
95
  'description' => __( 'View website in this language', 'connect-polylang-elementor' ),
96
+ 'actions' => array(
97
+ array(
98
  'name' => 'edit',
99
  'url' => esc_url_raw( admin_url( 'admin.php?page=mlang&pll_action=edit&lang=' . $lang_data->term_id ) ),
100
  'icon' => 'edit',
101
+ ),
102
+ ),
103
+ );
104
 
105
  } // end foreach
106
 
107
  foreach ( $languages as $lang_data ) {
108
 
109
+ $items[ 'polylang-language-' . $lang_data->slug ] = array(
110
  'title' => $string_polylang_lang . $lang_data->name,
111
  'url' => esc_url_raw( admin_url( 'admin.php?page=mlang&pll_action=edit&lang=' . $lang_data->term_id ) ),
112
  'icon' => 'edit',
113
+ 'keywords' => array(
114
  'polylang',
115
  'language',
116
  $lang_data->name,
117
  $lang_data->slug,
118
  'country',
119
+ $lang_data->locale,
120
+ ),
121
  'description' => __( 'Edit this language', 'connect-polylang-elementor' ),
122
+ 'actions' => array(
123
+ array(
124
  'name' => $action_name,
125
  'url' => esc_url( $lang_data->home_url ),
126
  'icon' => $action_icon,
127
+ ),
128
+ ),
129
+ );
130
 
131
  } // end foreach
132
  }
133
 
134
  /** Settings: Languages setup */
135
+ $items['languages'] = array(
136
  'title' => $string_polylang . _x( 'Setup languages', 'Title in Elementor Finder', 'connect-polylang-elementor' ),
137
  'url' => admin_url( 'admin.php?page=mlang' ),
138
  'icon' => 'comments',
139
+ 'keywords' => array( 'polylang', 'languages', 'setup', 'flags', 'country', 'countries' ),
140
  'description' => __( 'All languages your website appears in', 'connect-polylang-elementor' ),
141
+ );
142
 
143
  /** Settings: String translations */
144
+ $items['string-translations'] = array(
145
  'title' => $string_polylang . _x( 'String Translations', 'Title in Elementor Finder', 'connect-polylang-elementor' ),
146
  'url' => admin_url( 'admin.php?page=mlang_strings' ),
147
  'icon' => 'exchange',
148
+ 'keywords' => array( 'polylang', 'translations', 'translate', 'strings' ),
149
  'description' => __( 'From Widgets and other website parts', 'connect-polylang-elementor' ),
150
+ );
151
 
152
  /** Settings: General, for plugin */
153
+ $items['settings'] = array(
154
  'title' => $string_polylang . _x( 'Settings', 'Title in Elementor Finder', 'connect-polylang-elementor' ),
155
  'url' => admin_url( 'admin.php?page=mlang_settings' ),
156
  'icon' => 'settings',
157
+ 'keywords' => array( 'polylang', 'settings', 'options', 'modules' ),
158
  'description' => __( 'Plugin\'s settings, enable/ disable modules', 'connect-polylang-elementor' ),
159
+ );
160
 
161
  /** External: documentation */
162
+ $items['documentation'] = array(
163
  'title' => $string_polylang . _x( 'Plugin Documentation', 'Title in Elementor Finder', 'connect-polylang-elementor' ),
164
  'url' => 'https://polylang.pro/doc/',
165
  'icon' => 'info',
166
+ 'keywords' => array( 'help', 'support', 'docs', 'documentation', 'faq', 'knowledge base' ),
167
  'description' => __( 'FAQ, Knowledge Base and Documentation', 'connect-polylang-elementor' ),
168
+ 'actions' => array(
169
+ array(
170
  'name' => $action_name,
171
  'url' => 'https://polylang.pro/doc/',
172
  'icon' => $action_icon,
173
+ ),
174
+ ),
175
+ );
176
 
177
  /** External: WordPress.org support forum */
178
+ $items['support-forum'] = array(
179
  'title' => $string_polylang . _x( 'Support Forum', 'Title in Elementor Finder', 'connect-polylang-elementor' ),
180
  'url' => 'https://wordpress.org/support/plugin/polylang',
181
  'icon' => 'comments',
182
+ 'keywords' => array( 'support', 'forum', 'wordpress.org', 'help' ),
183
  'description' => __( 'Free support on WordPress.org', 'connect-polylang-elementor' ),
184
+ 'actions' => array(
185
+ array(
186
  'name' => $action_name,
187
  'url' => 'https://wordpress.org/support/plugin/polylang',
188
  'icon' => $action_icon,
189
+ ),
190
+ ),
191
+ );
192
 
193
  /** Return items array, filterable */
194
  return apply_filters(
196
  $items
197
  );
198
 
199
+ }
200
 
201
+ }
modules/widgets/polylang-language-switcher.php CHANGED
@@ -6,8 +6,8 @@ namespace DDW_Connect_Polylang_Elementor\Widgets;
6
 
7
  use Elementor\Widget_Base;
8
  use Elementor\Controls_Manager;
9
- use Elementor\Scheme_Color;
10
- use Elementor\Scheme_Typography;
11
  use Elementor\Group_Control_Border;
12
  use Elementor\Group_Control_Typography;
13
  use function function_exists;
@@ -30,6 +30,7 @@ if ( ! defined( 'ABSPATH' ) ) {
30
  *
31
  * Note: Code based on Widget class of plugin "Language Switcher for Elementor",
32
  * licensed under GPLv2 or later.
 
33
  * @author Solitweb
34
  * @link https://solitweb.be/
35
  *
@@ -50,7 +51,7 @@ class Polylang_Language_Switcher extends Widget_Base {
50
 
51
  return 'polylang-language-switcher';
52
 
53
- } // end method
54
 
55
 
56
  /**
@@ -66,7 +67,7 @@ class Polylang_Language_Switcher extends Widget_Base {
66
 
67
  return _x( 'Polylang Switcher', 'Elementor widget title', 'connect-polylang-elementor' );
68
 
69
- } // end method
70
 
71
 
72
  /**
@@ -82,7 +83,7 @@ class Polylang_Language_Switcher extends Widget_Base {
82
 
83
  return 'fa fa-language';
84
 
85
- } // end method
86
 
87
 
88
  /**
@@ -101,9 +102,9 @@ class Polylang_Language_Switcher extends Widget_Base {
101
  */
102
  public function get_categories() {
103
 
104
- return [ 'general', 'theme-elements' ];
105
 
106
- } // end method
107
 
108
 
109
  /**
@@ -113,9 +114,9 @@ class Polylang_Language_Switcher extends Widget_Base {
113
  */
114
  public function get_keywords() {
115
 
116
- return [ 'languages', 'switcher', 'polylang', 'multilingual', 'flags', 'countries', 'country', 'wpml' ];
117
 
118
- } // end method
119
 
120
 
121
  /**
@@ -131,9 +132,9 @@ class Polylang_Language_Switcher extends Widget_Base {
131
  */
132
  public function get_style_depends() {
133
 
134
- return [ 'plsfe-frontend' ];
135
 
136
- } // end method
137
 
138
 
139
  /**
@@ -149,9 +150,9 @@ class Polylang_Language_Switcher extends Widget_Base {
149
  */
150
  public function get_script_depends() {
151
 
152
- return [ ];
153
 
154
- } // end method
155
 
156
 
157
  /**
@@ -171,112 +172,114 @@ class Polylang_Language_Switcher extends Widget_Base {
171
  /** Content: Layout etc. */
172
  $this->start_controls_section(
173
  'section_content',
174
- [
175
  'label' => __( 'Content', 'connect-polylang-elementor' ),
176
- ]
177
  );
178
 
179
  $this->add_responsive_control(
180
  'layout',
181
- [
182
  'label' => __( 'Layout', 'connect-polylang-elementor' ),
183
  'type' => Controls_Manager::SELECT,
184
  'default' => 'horizontal',
185
- 'options' => [
186
  'horizontal' => __( 'Horizontal', 'connect-polylang-elementor' ),
187
  'vertical' => __( 'Vertical', 'connect-polylang-elementor' ),
188
- ],
189
  'label_block' => true,
190
  'prefix_class' => 'plsfe%s-layout-',
191
- ]
192
  );
193
 
194
  $this->add_responsive_control(
195
  'align_items',
196
- [
197
  'label' => __( 'Align', 'connect-polylang-elementor' ),
198
  'type' => Controls_Manager::CHOOSE,
199
- 'options' => [
200
- 'left' => [
201
  'title' => __( 'Left', 'connect-polylang-elementor' ),
202
  'icon' => 'eicon-h-align-left',
203
- ],
204
- 'center' => [
205
  'title' => __( 'Center', 'connect-polylang-elementor' ),
206
  'icon' => 'eicon-h-align-center',
207
- ],
208
- 'right' => [
209
  'title' => __( 'Right', 'connect-polylang-elementor' ),
210
  'icon' => 'eicon-h-align-right',
211
- ],
212
- 'justify' => [
213
  'title' => __( 'Stretch', 'connect-polylang-elementor' ),
214
  'icon' => 'eicon-h-align-stretch',
215
- ],
216
- ],
217
  'label_block' => true,
218
  'prefix_class' => 'plsfe%s-align-',
219
- ]
220
  );
221
 
222
  $this->add_control(
223
  'hide_current',
224
- [
225
  'label' => __( 'Hide the current language', 'connect-polylang-elementor' ),
226
  'type' => Controls_Manager::SWITCHER,
227
  'return_value' => 'yes',
228
  'default' => '',
229
  'separator' => 'before',
230
- ]
231
  );
232
 
233
  $this->add_control(
234
  'hide_missing',
235
- [
236
  'label' => __( 'Hide languages with no translation', 'connect-polylang-elementor' ),
237
  'type' => Controls_Manager::SWITCHER,
238
  'return_value' => 'yes',
239
  'default' => '',
240
- ]
241
  );
242
 
243
  $this->add_control(
244
  'show_country_flag',
245
- [
246
  'label' => __( 'Show Country Flag', 'connect-polylang-elementor' ),
247
  'type' => Controls_Manager::SWITCHER,
248
  'return_value' => 'yes',
249
  'default' => 'yes',
250
- ]
251
  );
252
 
253
  $this->add_control(
254
  'show_language_name',
255
- [
256
  'label' => __( 'Show Language Name', 'connect-polylang-elementor' ),
257
  'type' => Controls_Manager::SWITCHER,
258
  'return_value' => 'yes',
259
  'default' => 'yes',
260
- ]
261
  );
262
 
263
  $this->add_control(
264
  'show_language_code',
265
- [
266
  'label' => __( 'Show Language Code', 'connect-polylang-elementor' ),
267
  'type' => Controls_Manager::SWITCHER,
268
  'return_value' => 'yes',
269
  'default' => '',
270
- ]
271
  );
272
 
273
  /** Create language drop-down for the select control */
274
  if ( function_exists( 'pll_the_languages' ) ) {
275
  $languages = pll_the_languages( array( 'raw' => 1 ) );
276
- $dropdown = [];
277
 
278
- foreach ( $languages as $language ) {
279
- $dropdown[ $language['slug'] ] = $language['name'];
 
 
280
  }
281
 
282
  $first_key['all'] = __( 'All languages', 'connect-polylang-elementor' );
@@ -285,148 +288,147 @@ class Polylang_Language_Switcher extends Widget_Base {
285
 
286
  $this->add_control(
287
  'plsfe_widget_display',
288
- [
289
  'label' => __( 'Display widget for:', 'connect-polylang-elementor' ),
290
  'type' => Controls_Manager::SELECT,
291
  'default' => 'all',
292
  'options' => $dropdown,
293
- ]
294
  );
295
  }
296
 
297
  $this->end_controls_section();
298
 
299
-
300
  /** Style: Main menu */
301
  $this->start_controls_section(
302
  'main_section',
303
- [
304
  'label' => __( 'Main Menu', 'connect-polylang-elementor' ),
305
  'tab' => Controls_Manager::TAB_STYLE,
306
- ]
307
  );
308
 
309
  $this->start_controls_tabs( 'tabs_menu_item_style' );
310
 
311
  $this->start_controls_tab(
312
  'tab_menu_item_normal',
313
- [
314
  'label' => __( 'Normal', 'connect-polylang-elementor' ),
315
- ]
316
  );
317
 
318
  $this->add_group_control(
319
  Group_Control_Typography::get_type(),
320
- [
321
  'name' => 'typography_menu_item',
322
- 'scheme' => Scheme_Typography::TYPOGRAPHY_1,
323
  'selector' => '{{WRAPPER}} .plsfe-menu .plsfe-item',
324
- ]
325
  );
326
 
327
  $this->add_control(
328
  'color_menu_item',
329
- [
330
  'label' => __( 'Text Color', 'connect-polylang-elementor' ),
331
  'type' => Controls_Manager::COLOR,
332
- 'scheme' => [
333
- 'type' => Scheme_Color::get_type(),
334
- 'value' => Scheme_Color::COLOR_3,
335
- ],
336
  'default' => '',
337
- 'selectors' => [
338
  '{{WRAPPER}} .plsfe-menu .plsfe-item' => 'color: {{VALUE}}',
339
- ],
340
- ]
341
  );
342
 
343
  $this->end_controls_tab();
344
 
345
  $this->start_controls_tab(
346
  'tab_menu_item_hover',
347
- [
348
  'label' => __( 'Hover', 'connect-polylang-elementor' ),
349
- ]
350
  );
351
 
352
  $this->add_group_control(
353
  Group_Control_Typography::get_type(),
354
- [
355
  'name' => 'typography_menu_item_hover',
356
- 'scheme' => Scheme_Typography::TYPOGRAPHY_1,
357
  'selector' => '{{WRAPPER}} .plsfe-menu .plsfe-item:hover,
358
  {{WRAPPER}} .plsfe-menu .plsfe-item.plsfe-item__active,
359
  {{WRAPPER}} .plsfe-menu .plsfe-item.highlighted,
360
  {{WRAPPER}} .plsfe-menu .plsfe-item:focus',
361
- ]
362
  );
363
 
364
  $this->add_control(
365
  'color_menu_item_hover',
366
- [
367
  'label' => __( 'Text Color', 'connect-polylang-elementor' ),
368
  'type' => Controls_Manager::COLOR,
369
- 'scheme' => [
370
- 'type' => Scheme_Color::get_type(),
371
- 'value' => Scheme_Color::COLOR_4,
372
- ],
373
- 'selectors' => [
374
  '{{WRAPPER}} .plsfe-menu .plsfe-item:hover,
375
  {{WRAPPER}} .plsfe-menu .plsfe-item.highlighted,
376
  {{WRAPPER}} .plsfe-menu .plsfe-item:focus' => 'color: {{VALUE}}',
377
- ],
378
- ]
379
  );
380
 
381
  $this->end_controls_tab();
382
 
383
  $this->start_controls_tab(
384
  'tab_menu_item_active',
385
- [
386
  'label' => __( 'Active', 'connect-polylang-elementor' ),
387
- ]
388
  );
389
 
390
  $this->add_control(
391
  'info_menu_item_active',
392
- [
393
  'type' => Controls_Manager::RAW_HTML,
394
  'raw' => __( 'This controls the item in the Switcher for the current active language', 'connect-polylang-elementor' ),
395
  'content_classes' => 'elementor-control-field-description cpel-info-menu-item-active',
396
- ]
397
  );
398
 
399
  $this->add_group_control(
400
  Group_Control_Typography::get_type(),
401
- [
402
  'name' => 'typography_menu_item_active',
403
- 'scheme' => Scheme_Typography::TYPOGRAPHY_1,
404
  'selector' => '{{WRAPPER}} .plsfe-menu .plsfe-item.plsfe-item__active',
405
- ]
406
  );
407
 
408
  $this->add_control(
409
  'color_menu_item_active',
410
- [
411
  'label' => __( 'Text Color', 'connect-polylang-elementor' ),
412
  'type' => Controls_Manager::COLOR,
413
  'default' => '',
414
- 'selectors' => [
415
  '{{WRAPPER}} .plsfe-menu .plsfe-item.plsfe-item__active' => 'color: {{VALUE}}',
416
- ],
417
- ]
418
  );
419
 
420
  $this->add_control(
421
  'color_menu_item_active_hover',
422
- [
423
  'label' => __( 'Text Hover Color', 'connect-polylang-elementor' ),
424
  'type' => Controls_Manager::COLOR,
425
  'default' => '',
426
- 'selectors' => [
427
  '{{WRAPPER}} .plsfe-menu .plsfe-item.plsfe-item__active:hover' => 'color: {{VALUE}}',
428
- ],
429
- ]
430
  );
431
 
432
  $this->end_controls_tab();
@@ -435,193 +437,189 @@ class Polylang_Language_Switcher extends Widget_Base {
435
 
436
  $this->add_responsive_control(
437
  'padding_horizontal_menu_item',
438
- [
439
  'label' => __( 'Horizontal Padding', 'connect-polylang-elementor' ),
440
  'type' => Controls_Manager::SLIDER,
441
- 'range' => [
442
- 'px' => [
443
  'max' => 50,
444
- ],
445
- ],
446
  'separator' => 'before',
447
- 'selectors' => [
448
  '{{WRAPPER}} .plsfe-switcher .plsfe-item' => 'padding-left: {{SIZE}}{{UNIT}}; padding-right: {{SIZE}}{{UNIT}}',
449
- ],
450
- ]
451
  );
452
 
453
  $this->add_responsive_control(
454
  'padding_vertical_menu_item',
455
- [
456
  'label' => __( 'Vertical Padding', 'connect-polylang-elementor' ),
457
  'type' => Controls_Manager::SLIDER,
458
- 'range' => [
459
- 'px' => [
460
  'max' => 50,
461
- ],
462
- ],
463
- 'selectors' => [
464
  '{{WRAPPER}} .plsfe-switcher .plsfe-item' => 'padding-top: {{SIZE}}{{UNIT}}; padding-bottom: {{SIZE}}{{UNIT}}',
465
- ],
466
- ]
467
  );
468
 
469
  $this->add_responsive_control(
470
  'menu_space_between',
471
- [
472
  'label' => __( 'Space Between', 'connect-polylang-elementor' ),
473
  'type' => Controls_Manager::SLIDER,
474
- 'range' => [
475
- 'px' => [
476
  'max' => 100,
477
- ],
478
- ],
479
- 'selectors' => [
480
  'body:not(.rtl) {{WRAPPER}}.plsfe-layout-horizontal:not(.plsfe-layout-vertical) .plsfe-menu > li:not(:last-child)' => 'margin-right: {{SIZE}}{{UNIT}}',
481
  'body.rtl {{WRAPPER}}.plsfe-layout-horizontal:not(.plsfe-layout-vertical) .plsfe-menu > li:not(:last-child)' => 'margin-left: {{SIZE}}{{UNIT}}',
482
  '{{WRAPPER}}.plsfe-layout-vertical:not(.plsfe-layout-horizontal) .plsfe-menu > li:not(:last-child)' => 'margin-bottom: {{SIZE}}{{UNIT}}',
483
- ],
484
- ]
485
  );
486
 
487
  $this->add_group_control(
488
  Group_Control_Border::get_type(),
489
- [
490
  'name' => 'menu_item_border',
491
  'selector' => '{{WRAPPER}} .plsfe-menu > li',
492
  'separator' => 'before',
493
- ]
494
  );
495
 
496
  $this->end_controls_section();
497
 
498
-
499
  /** Style: Language flag */
500
  $this->start_controls_section(
501
  'country_flag_section',
502
- [
503
  'label' => __( 'Country Flag', 'connect-polylang-elementor' ),
504
  'tab' => Controls_Manager::TAB_STYLE,
505
- 'condition' => [
506
- 'show_country_flag' => [ 'yes' ],
507
- ],
508
- ]
509
  );
510
 
511
  $this->add_control(
512
  'margin_country_flag',
513
- [
514
  'label' => __( 'Margin', 'connect-polylang-elementor' ),
515
  'type' => Controls_Manager::DIMENSIONS,
516
- 'size_units' => [ 'px', '%', 'em' ],
517
- 'selectors' => [
518
  '{{WRAPPER}} .plsfe-switcher .plsfe-country-flag' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
519
- ],
520
- ]
521
  );
522
 
523
  $this->end_controls_section();
524
 
525
-
526
  /** Style: Language name */
527
  $this->start_controls_section(
528
  'language_name_section',
529
- [
530
  'label' => __( 'Language Name', 'connect-polylang-elementor' ),
531
  'tab' => Controls_Manager::TAB_STYLE,
532
- 'condition' => [
533
- 'show_language_name' => [ 'yes' ],
534
- ],
535
- ]
536
  );
537
 
538
  $this->add_control(
539
  'uppercase_language_name',
540
- [
541
  'label' => __( 'Uppercase', 'connect-polylang-elementor' ),
542
  'type' => Controls_Manager::SWITCHER,
543
  'return_value' => 'yes',
544
  'default' => '',
545
- ]
546
  );
547
 
548
  $this->add_control(
549
  'margin_language_name',
550
- [
551
  'label' => __( 'Margin', 'connect-polylang-elementor' ),
552
  'type' => Controls_Manager::DIMENSIONS,
553
- 'size_units' => [ 'px', '%', 'em' ],
554
- 'selectors' => [
555
  '{{WRAPPER}} .plsfe-switcher .plsfe-language-name' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
556
- ],
557
- ]
558
  );
559
 
560
  $this->end_controls_section();
561
 
562
-
563
  /** Style: Language code */
564
  $this->start_controls_section(
565
  'language_code_section',
566
- [
567
  'label' => __( 'Language Code', 'connect-polylang-elementor' ),
568
  'tab' => Controls_Manager::TAB_STYLE,
569
- 'condition' => [
570
- 'show_language_code' => [ 'yes' ],
571
- ],
572
- ]
573
  );
574
 
575
  $this->add_control(
576
  'uppercase_language_code',
577
- [
578
  'label' => __( 'Uppercase', 'connect-polylang-elementor' ),
579
  'type' => Controls_Manager::SWITCHER,
580
  'return_value' => 'yes',
581
  'default' => 'yes',
582
- ]
583
  );
584
 
585
  $this->add_control(
586
  'margin_language_code',
587
- [
588
  'label' => __( 'Margin', 'connect-polylang-elementor' ),
589
  'type' => Controls_Manager::DIMENSIONS,
590
- 'size_units' => [ 'px', '%', 'em' ],
591
- 'selectors' => [
592
  '{{WRAPPER}} .plsfe-switcher .plsfe-language-code' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
593
- ],
594
- ]
595
  );
596
 
597
  $this->add_control(
598
  'before_language_code',
599
- [
600
- 'label' => __( 'Text before', 'connect-polylang-elementor' ),
601
- 'type' => Controls_Manager::TEXT,
602
- ]
603
  );
604
 
605
  $this->add_control(
606
  'after_language_code',
607
- [
608
- 'label' => __( 'Text after', 'connect-polylang-elementor' ),
609
- 'type' => Controls_Manager::TEXT,
610
- ]
611
  );
612
 
613
  $this->end_controls_section();
614
 
615
-
616
  /** Help information - user guidance */
617
  $this->start_controls_section(
618
  'section_helpful_info',
619
- [
620
  'label' => __( 'Helpful Information', 'connect-polylang-elementor' ),
621
- ]
622
  );
623
 
624
- $output = '<div style="line-height: 1.2;">';
625
  $output .= sprintf(
626
  '<p style="margin-bottom: 15px;"><strong>%1$s:</strong><br />%2$s</p>',
627
  __( 'Country Flags', 'connect-polylang-elementor' ),
@@ -643,16 +641,16 @@ class Polylang_Language_Switcher extends Widget_Base {
643
 
644
  $this->add_control(
645
  'plsfe_help_info',
646
- [
647
  'type' => Controls_Manager::RAW_HTML,
648
  'raw' => $output,
649
  'content_classes' => 'cpel-help-info',
650
- ]
651
  );
652
 
653
  $this->end_controls_section();
654
 
655
- } // end method
656
 
657
 
658
  /**
@@ -672,9 +670,13 @@ class Polylang_Language_Switcher extends Widget_Base {
672
  $settings = $this->get_active_settings();
673
 
674
  /** Add render attributes for Elementor */
675
- $this->add_render_attribute( 'main-menu', 'class', [
676
- 'plsfe-switcher',
677
- ] );
 
 
 
 
678
 
679
  /** Get the available languages for a switcher */
680
  $languages = '';
@@ -691,45 +693,45 @@ class Polylang_Language_Switcher extends Widget_Base {
691
  foreach ( $languages as $language ) {
692
 
693
  /** Optional: Hide the current language */
694
- if ( 'yes' === $settings[ 'hide_current' ] && $language[ 'current_lang' ] ) {
695
  continue;
696
  }
697
 
698
  /** Optional: Hide languages that have no translations available */
699
- if ( 'yes' === $settings[ 'hide_missing' ] && $language[ 'no_translation' ] ) {
700
  continue;
701
  }
702
 
703
  /** Language code: uppercase/ lowercase logic */
704
- $language_code = ( 'yes' === $settings[ 'uppercase_language_code' ] ) ? strtoupper( $language[ 'slug' ] ) : strtolower( $language[ 'slug' ] );
705
 
706
  /** Language name: uppercase/ lowercase logic */
707
- $language_name = ( 'yes' === $settings[ 'uppercase_language_name' ] ) ? strtoupper( $language[ 'name' ] ) : $language[ 'name' ];
708
 
709
  /** Build the language switcher menu output */
710
  echo '<li class="plsfe-menu-item">';
711
 
712
- echo ( $language[ 'current_lang' ] ) ? '<a href="' . $language[ 'url' ] . '" class="plsfe-item plsfe-item__active">' : '<a href="' . $language[ 'url' ] . '" class="plsfe-item">';
713
 
714
- echo $settings[ 'show_country_flag' ] ? '<span class="plsfe-country-flag"><img src="' . $language[ 'flag' ] . '" alt="' . $language_code . '" width="16" height="11" /></span>' : '';
715
 
716
- echo $settings[ 'show_language_name' ] ? '<span class="plsfe-language-name">' . $language_name . '</span>' : '';
717
 
718
- echo $settings[ 'before_language_code' ] ?: '';
719
- echo $settings[ 'show_language_code' ] ? '<span class="plsfe-language-code">' . $language_code . '</span>' : '';
720
- echo $settings[ 'after_language_code' ] ?: '';
721
 
722
  echo '</a>';
723
 
724
  echo '</li>';
725
 
726
- } // end if
727
 
728
  echo '</ul></nav>';
729
 
730
- } // end if
731
 
732
- } // end method
733
 
734
 
735
  /**
@@ -742,6 +744,6 @@ class Polylang_Language_Switcher extends Widget_Base {
742
  *
743
  * @access protected
744
  */
745
- protected function _content_template() { } // end method
746
 
747
- } // end of class
6
 
7
  use Elementor\Widget_Base;
8
  use Elementor\Controls_Manager;
9
+ use Elementor\Core\Schemes\Color;
10
+ use Elementor\Core\Schemes\Typography;
11
  use Elementor\Group_Control_Border;
12
  use Elementor\Group_Control_Typography;
13
  use function function_exists;
30
  *
31
  * Note: Code based on Widget class of plugin "Language Switcher for Elementor",
32
  * licensed under GPLv2 or later.
33
+ *
34
  * @author Solitweb
35
  * @link https://solitweb.be/
36
  *
51
 
52
  return 'polylang-language-switcher';
53
 
54
+ }
55
 
56
 
57
  /**
67
 
68
  return _x( 'Polylang Switcher', 'Elementor widget title', 'connect-polylang-elementor' );
69
 
70
+ }
71
 
72
 
73
  /**
83
 
84
  return 'fa fa-language';
85
 
86
+ }
87
 
88
 
89
  /**
102
  */
103
  public function get_categories() {
104
 
105
+ return array( 'general', 'theme-elements' );
106
 
107
+ }
108
 
109
 
110
  /**
114
  */
115
  public function get_keywords() {
116
 
117
+ return array( 'languages', 'switcher', 'polylang', 'multilingual', 'flags', 'countries', 'country', 'wpml' );
118
 
119
+ }
120
 
121
 
122
  /**
132
  */
133
  public function get_style_depends() {
134
 
135
+ return array( 'plsfe-frontend' );
136
 
137
+ }
138
 
139
 
140
  /**
150
  */
151
  public function get_script_depends() {
152
 
153
+ return array();
154
 
155
+ }
156
 
157
 
158
  /**
172
  /** Content: Layout etc. */
173
  $this->start_controls_section(
174
  'section_content',
175
+ array(
176
  'label' => __( 'Content', 'connect-polylang-elementor' ),
177
+ )
178
  );
179
 
180
  $this->add_responsive_control(
181
  'layout',
182
+ array(
183
  'label' => __( 'Layout', 'connect-polylang-elementor' ),
184
  'type' => Controls_Manager::SELECT,
185
  'default' => 'horizontal',
186
+ 'options' => array(
187
  'horizontal' => __( 'Horizontal', 'connect-polylang-elementor' ),
188
  'vertical' => __( 'Vertical', 'connect-polylang-elementor' ),
189
+ ),
190
  'label_block' => true,
191
  'prefix_class' => 'plsfe%s-layout-',
192
+ )
193
  );
194
 
195
  $this->add_responsive_control(
196
  'align_items',
197
+ array(
198
  'label' => __( 'Align', 'connect-polylang-elementor' ),
199
  'type' => Controls_Manager::CHOOSE,
200
+ 'options' => array(
201
+ 'left' => array(
202
  'title' => __( 'Left', 'connect-polylang-elementor' ),
203
  'icon' => 'eicon-h-align-left',
204
+ ),
205
+ 'center' => array(
206
  'title' => __( 'Center', 'connect-polylang-elementor' ),
207
  'icon' => 'eicon-h-align-center',
208
+ ),
209
+ 'right' => array(
210
  'title' => __( 'Right', 'connect-polylang-elementor' ),
211
  'icon' => 'eicon-h-align-right',
212
+ ),
213
+ 'justify' => array(
214
  'title' => __( 'Stretch', 'connect-polylang-elementor' ),
215
  'icon' => 'eicon-h-align-stretch',
216
+ ),
217
+ ),
218
  'label_block' => true,
219
  'prefix_class' => 'plsfe%s-align-',
220
+ )
221
  );
222
 
223
  $this->add_control(
224
  'hide_current',
225
+ array(
226
  'label' => __( 'Hide the current language', 'connect-polylang-elementor' ),
227
  'type' => Controls_Manager::SWITCHER,
228
  'return_value' => 'yes',
229
  'default' => '',
230
  'separator' => 'before',
231
+ )
232
  );
233
 
234
  $this->add_control(
235
  'hide_missing',
236
+ array(
237
  'label' => __( 'Hide languages with no translation', 'connect-polylang-elementor' ),
238
  'type' => Controls_Manager::SWITCHER,
239
  'return_value' => 'yes',
240
  'default' => '',
241
+ )
242
  );
243
 
244
  $this->add_control(
245
  'show_country_flag',
246
+ array(
247
  'label' => __( 'Show Country Flag', 'connect-polylang-elementor' ),
248
  'type' => Controls_Manager::SWITCHER,
249
  'return_value' => 'yes',
250
  'default' => 'yes',
251
+ )
252
  );
253
 
254
  $this->add_control(
255
  'show_language_name',
256
+ array(
257
  'label' => __( 'Show Language Name', 'connect-polylang-elementor' ),
258
  'type' => Controls_Manager::SWITCHER,
259
  'return_value' => 'yes',
260
  'default' => 'yes',
261
+ )
262
  );
263
 
264
  $this->add_control(
265
  'show_language_code',
266
+ array(
267
  'label' => __( 'Show Language Code', 'connect-polylang-elementor' ),
268
  'type' => Controls_Manager::SWITCHER,
269
  'return_value' => 'yes',
270
  'default' => '',
271
+ )
272
  );
273
 
274
  /** Create language drop-down for the select control */
275
  if ( function_exists( 'pll_the_languages' ) ) {
276
  $languages = pll_the_languages( array( 'raw' => 1 ) );
277
+ $dropdown = array();
278
 
279
+ if ( is_array( $languages ) ) {
280
+ foreach ( $languages as $language ) {
281
+ $dropdown[ $language['slug'] ] = $language['name'];
282
+ }
283
  }
284
 
285
  $first_key['all'] = __( 'All languages', 'connect-polylang-elementor' );
288
 
289
  $this->add_control(
290
  'plsfe_widget_display',
291
+ array(
292
  'label' => __( 'Display widget for:', 'connect-polylang-elementor' ),
293
  'type' => Controls_Manager::SELECT,
294
  'default' => 'all',
295
  'options' => $dropdown,
296
+ )
297
  );
298
  }
299
 
300
  $this->end_controls_section();
301
 
 
302
  /** Style: Main menu */
303
  $this->start_controls_section(
304
  'main_section',
305
+ array(
306
  'label' => __( 'Main Menu', 'connect-polylang-elementor' ),
307
  'tab' => Controls_Manager::TAB_STYLE,
308
+ )
309
  );
310
 
311
  $this->start_controls_tabs( 'tabs_menu_item_style' );
312
 
313
  $this->start_controls_tab(
314
  'tab_menu_item_normal',
315
+ array(
316
  'label' => __( 'Normal', 'connect-polylang-elementor' ),
317
+ )
318
  );
319
 
320
  $this->add_group_control(
321
  Group_Control_Typography::get_type(),
322
+ array(
323
  'name' => 'typography_menu_item',
324
+ 'scheme' => Typography::TYPOGRAPHY_1,
325
  'selector' => '{{WRAPPER}} .plsfe-menu .plsfe-item',
326
+ )
327
  );
328
 
329
  $this->add_control(
330
  'color_menu_item',
331
+ array(
332
  'label' => __( 'Text Color', 'connect-polylang-elementor' ),
333
  'type' => Controls_Manager::COLOR,
334
+ 'scheme' => array(
335
+ 'type' => Color::get_type(),
336
+ 'value' => Color::COLOR_3,
337
+ ),
338
  'default' => '',
339
+ 'selectors' => array(
340
  '{{WRAPPER}} .plsfe-menu .plsfe-item' => 'color: {{VALUE}}',
341
+ ),
342
+ )
343
  );
344
 
345
  $this->end_controls_tab();
346
 
347
  $this->start_controls_tab(
348
  'tab_menu_item_hover',
349
+ array(
350
  'label' => __( 'Hover', 'connect-polylang-elementor' ),
351
+ )
352
  );
353
 
354
  $this->add_group_control(
355
  Group_Control_Typography::get_type(),
356
+ array(
357
  'name' => 'typography_menu_item_hover',
358
+ 'scheme' => Typography::TYPOGRAPHY_1,
359
  'selector' => '{{WRAPPER}} .plsfe-menu .plsfe-item:hover,
360
  {{WRAPPER}} .plsfe-menu .plsfe-item.plsfe-item__active,
361
  {{WRAPPER}} .plsfe-menu .plsfe-item.highlighted,
362
  {{WRAPPER}} .plsfe-menu .plsfe-item:focus',
363
+ )
364
  );
365
 
366
  $this->add_control(
367
  'color_menu_item_hover',
368
+ array(
369
  'label' => __( 'Text Color', 'connect-polylang-elementor' ),
370
  'type' => Controls_Manager::COLOR,
371
+ 'scheme' => array(
372
+ 'type' => Color::get_type(),
373
+ 'value' => Color::COLOR_4,
374
+ ),
375
+ 'selectors' => array(
376
  '{{WRAPPER}} .plsfe-menu .plsfe-item:hover,
377
  {{WRAPPER}} .plsfe-menu .plsfe-item.highlighted,
378
  {{WRAPPER}} .plsfe-menu .plsfe-item:focus' => 'color: {{VALUE}}',
379
+ ),
380
+ )
381
  );
382
 
383
  $this->end_controls_tab();
384
 
385
  $this->start_controls_tab(
386
  'tab_menu_item_active',
387
+ array(
388
  'label' => __( 'Active', 'connect-polylang-elementor' ),
389
+ )
390
  );
391
 
392
  $this->add_control(
393
  'info_menu_item_active',
394
+ array(
395
  'type' => Controls_Manager::RAW_HTML,
396
  'raw' => __( 'This controls the item in the Switcher for the current active language', 'connect-polylang-elementor' ),
397
  'content_classes' => 'elementor-control-field-description cpel-info-menu-item-active',
398
+ )
399
  );
400
 
401
  $this->add_group_control(
402
  Group_Control_Typography::get_type(),
403
+ array(
404
  'name' => 'typography_menu_item_active',
405
+ 'scheme' => Typography::TYPOGRAPHY_1,
406
  'selector' => '{{WRAPPER}} .plsfe-menu .plsfe-item.plsfe-item__active',
407
+ )
408
  );
409
 
410
  $this->add_control(
411
  'color_menu_item_active',
412
+ array(
413
  'label' => __( 'Text Color', 'connect-polylang-elementor' ),
414
  'type' => Controls_Manager::COLOR,
415
  'default' => '',
416
+ 'selectors' => array(
417
  '{{WRAPPER}} .plsfe-menu .plsfe-item.plsfe-item__active' => 'color: {{VALUE}}',
418
+ ),
419
+ )
420
  );
421
 
422
  $this->add_control(
423
  'color_menu_item_active_hover',
424
+ array(
425
  'label' => __( 'Text Hover Color', 'connect-polylang-elementor' ),
426
  'type' => Controls_Manager::COLOR,
427
  'default' => '',
428
+ 'selectors' => array(
429
  '{{WRAPPER}} .plsfe-menu .plsfe-item.plsfe-item__active:hover' => 'color: {{VALUE}}',
430
+ ),
431
+ )
432
  );
433
 
434
  $this->end_controls_tab();
437
 
438
  $this->add_responsive_control(
439
  'padding_horizontal_menu_item',
440
+ array(
441
  'label' => __( 'Horizontal Padding', 'connect-polylang-elementor' ),
442
  'type' => Controls_Manager::SLIDER,
443
+ 'range' => array(
444
+ 'px' => array(
445
  'max' => 50,
446
+ ),
447
+ ),
448
  'separator' => 'before',
449
+ 'selectors' => array(
450
  '{{WRAPPER}} .plsfe-switcher .plsfe-item' => 'padding-left: {{SIZE}}{{UNIT}}; padding-right: {{SIZE}}{{UNIT}}',
451
+ ),
452
+ )
453
  );
454
 
455
  $this->add_responsive_control(
456
  'padding_vertical_menu_item',
457
+ array(
458
  'label' => __( 'Vertical Padding', 'connect-polylang-elementor' ),
459
  'type' => Controls_Manager::SLIDER,
460
+ 'range' => array(
461
+ 'px' => array(
462
  'max' => 50,
463
+ ),
464
+ ),
465
+ 'selectors' => array(
466
  '{{WRAPPER}} .plsfe-switcher .plsfe-item' => 'padding-top: {{SIZE}}{{UNIT}}; padding-bottom: {{SIZE}}{{UNIT}}',
467
+ ),
468
+ )
469
  );
470
 
471
  $this->add_responsive_control(
472
  'menu_space_between',
473
+ array(
474
  'label' => __( 'Space Between', 'connect-polylang-elementor' ),
475
  'type' => Controls_Manager::SLIDER,
476
+ 'range' => array(
477
+ 'px' => array(
478
  'max' => 100,
479
+ ),
480
+ ),
481
+ 'selectors' => array(
482
  'body:not(.rtl) {{WRAPPER}}.plsfe-layout-horizontal:not(.plsfe-layout-vertical) .plsfe-menu > li:not(:last-child)' => 'margin-right: {{SIZE}}{{UNIT}}',
483
  'body.rtl {{WRAPPER}}.plsfe-layout-horizontal:not(.plsfe-layout-vertical) .plsfe-menu > li:not(:last-child)' => 'margin-left: {{SIZE}}{{UNIT}}',
484
  '{{WRAPPER}}.plsfe-layout-vertical:not(.plsfe-layout-horizontal) .plsfe-menu > li:not(:last-child)' => 'margin-bottom: {{SIZE}}{{UNIT}}',
485
+ ),
486
+ )
487
  );
488
 
489
  $this->add_group_control(
490
  Group_Control_Border::get_type(),
491
+ array(
492
  'name' => 'menu_item_border',
493
  'selector' => '{{WRAPPER}} .plsfe-menu > li',
494
  'separator' => 'before',
495
+ )
496
  );
497
 
498
  $this->end_controls_section();
499
 
 
500
  /** Style: Language flag */
501
  $this->start_controls_section(
502
  'country_flag_section',
503
+ array(
504
  'label' => __( 'Country Flag', 'connect-polylang-elementor' ),
505
  'tab' => Controls_Manager::TAB_STYLE,
506
+ 'condition' => array(
507
+ 'show_country_flag' => array( 'yes' ),
508
+ ),
509
+ )
510
  );
511
 
512
  $this->add_control(
513
  'margin_country_flag',
514
+ array(
515
  'label' => __( 'Margin', 'connect-polylang-elementor' ),
516
  'type' => Controls_Manager::DIMENSIONS,
517
+ 'size_units' => array( 'px', '%', 'em' ),
518
+ 'selectors' => array(
519
  '{{WRAPPER}} .plsfe-switcher .plsfe-country-flag' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
520
+ ),
521
+ )
522
  );
523
 
524
  $this->end_controls_section();
525
 
 
526
  /** Style: Language name */
527
  $this->start_controls_section(
528
  'language_name_section',
529
+ array(
530
  'label' => __( 'Language Name', 'connect-polylang-elementor' ),
531
  'tab' => Controls_Manager::TAB_STYLE,
532
+ 'condition' => array(
533
+ 'show_language_name' => array( 'yes' ),
534
+ ),
535
+ )
536
  );
537
 
538
  $this->add_control(
539
  'uppercase_language_name',
540
+ array(
541
  'label' => __( 'Uppercase', 'connect-polylang-elementor' ),
542
  'type' => Controls_Manager::SWITCHER,
543
  'return_value' => 'yes',
544
  'default' => '',
545
+ )
546
  );
547
 
548
  $this->add_control(
549
  'margin_language_name',
550
+ array(
551
  'label' => __( 'Margin', 'connect-polylang-elementor' ),
552
  'type' => Controls_Manager::DIMENSIONS,
553
+ 'size_units' => array( 'px', '%', 'em' ),
554
+ 'selectors' => array(
555
  '{{WRAPPER}} .plsfe-switcher .plsfe-language-name' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
556
+ ),
557
+ )
558
  );
559
 
560
  $this->end_controls_section();
561
 
 
562
  /** Style: Language code */
563
  $this->start_controls_section(
564
  'language_code_section',
565
+ array(
566
  'label' => __( 'Language Code', 'connect-polylang-elementor' ),
567
  'tab' => Controls_Manager::TAB_STYLE,
568
+ 'condition' => array(
569
+ 'show_language_code' => array( 'yes' ),
570
+ ),
571
+ )
572
  );
573
 
574
  $this->add_control(
575
  'uppercase_language_code',
576
+ array(
577
  'label' => __( 'Uppercase', 'connect-polylang-elementor' ),
578
  'type' => Controls_Manager::SWITCHER,
579
  'return_value' => 'yes',
580
  'default' => 'yes',
581
+ )
582
  );
583
 
584
  $this->add_control(
585
  'margin_language_code',
586
+ array(
587
  'label' => __( 'Margin', 'connect-polylang-elementor' ),
588
  'type' => Controls_Manager::DIMENSIONS,
589
+ 'size_units' => array( 'px', '%', 'em' ),
590
+ 'selectors' => array(
591
  '{{WRAPPER}} .plsfe-switcher .plsfe-language-code' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
592
+ ),
593
+ )
594
  );
595
 
596
  $this->add_control(
597
  'before_language_code',
598
+ array(
599
+ 'label' => __( 'Text before', 'connect-polylang-elementor' ),
600
+ 'type' => Controls_Manager::TEXT,
601
+ )
602
  );
603
 
604
  $this->add_control(
605
  'after_language_code',
606
+ array(
607
+ 'label' => __( 'Text after', 'connect-polylang-elementor' ),
608
+ 'type' => Controls_Manager::TEXT,
609
+ )
610
  );
611
 
612
  $this->end_controls_section();
613
 
 
614
  /** Help information - user guidance */
615
  $this->start_controls_section(
616
  'section_helpful_info',
617
+ array(
618
  'label' => __( 'Helpful Information', 'connect-polylang-elementor' ),
619
+ )
620
  );
621
 
622
+ $output = '<div style="line-height: 1.2;">';
623
  $output .= sprintf(
624
  '<p style="margin-bottom: 15px;"><strong>%1$s:</strong><br />%2$s</p>',
625
  __( 'Country Flags', 'connect-polylang-elementor' ),
641
 
642
  $this->add_control(
643
  'plsfe_help_info',
644
+ array(
645
  'type' => Controls_Manager::RAW_HTML,
646
  'raw' => $output,
647
  'content_classes' => 'cpel-help-info',
648
+ )
649
  );
650
 
651
  $this->end_controls_section();
652
 
653
+ }
654
 
655
 
656
  /**
670
  $settings = $this->get_active_settings();
671
 
672
  /** Add render attributes for Elementor */
673
+ $this->add_render_attribute(
674
+ 'main-menu',
675
+ 'class',
676
+ array(
677
+ 'plsfe-switcher',
678
+ )
679
+ );
680
 
681
  /** Get the available languages for a switcher */
682
  $languages = '';
693
  foreach ( $languages as $language ) {
694
 
695
  /** Optional: Hide the current language */
696
+ if ( 'yes' === $settings['hide_current'] && $language['current_lang'] ) {
697
  continue;
698
  }
699
 
700
  /** Optional: Hide languages that have no translations available */
701
+ if ( 'yes' === $settings['hide_missing'] && $language['no_translation'] ) {
702
  continue;
703
  }
704
 
705
  /** Language code: uppercase/ lowercase logic */
706
+ $language_code = ( 'yes' === $settings['uppercase_language_code'] ) ? strtoupper( $language['slug'] ) : strtolower( $language['slug'] );
707
 
708
  /** Language name: uppercase/ lowercase logic */
709
+ $language_name = ( 'yes' === $settings['uppercase_language_name'] ) ? strtoupper( $language['name'] ) : $language['name'];
710
 
711
  /** Build the language switcher menu output */
712
  echo '<li class="plsfe-menu-item">';
713
 
714
+ echo ( $language['current_lang'] ) ? '<a href="' . $language['url'] . '" class="plsfe-item plsfe-item__active">' : '<a href="' . $language['url'] . '" class="plsfe-item">';
715
 
716
+ echo $settings['show_country_flag'] ? '<span class="plsfe-country-flag"><img src="' . $language['flag'] . '" alt="' . $language_code . '" width="16" height="11" /></span>' : '';
717
 
718
+ echo $settings['show_language_name'] ? '<span class="plsfe-language-name">' . $language_name . '</span>' : '';
719
 
720
+ echo $settings['before_language_code'] ?: '';
721
+ echo $settings['show_language_code'] ? '<span class="plsfe-language-code">' . $language_code . '</span>' : '';
722
+ echo $settings['after_language_code'] ?: '';
723
 
724
  echo '</a>';
725
 
726
  echo '</li>';
727
 
728
+ }
729
 
730
  echo '</ul></nav>';
731
 
732
+ }
733
 
734
+ }
735
 
736
 
737
  /**
744
  *
745
  * @access protected
746
  */
747
+ protected function _content_template() { }
748
 
749
+ }
modules/widgets/register-widget.php CHANGED
@@ -36,7 +36,7 @@ class Register_Widget {
36
 
37
  $this->add_actions();
38
 
39
- } // end method
40
 
41
 
42
  /**
@@ -48,31 +48,37 @@ class Register_Widget {
48
  */
49
  private function add_actions() {
50
 
51
- add_action( 'elementor/widgets/widgets_registered', [ $this, 'on_widgets_registered' ] );
52
 
53
- add_action( 'elementor/preview/enqueue_styles', function() {
54
- $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
 
 
55
 
56
- wp_enqueue_style(
57
- 'plsfe-editor',
58
- plugins_url( '/assets/css/plsfe-editor' . $suffix . '.css', CPEL__FILE__ ),
59
- '',
60
- CPEL_PLUGIN_VERSION
61
- );
62
- } );
 
63
 
64
- add_action( 'elementor/frontend/after_enqueue_styles', function() {
65
- $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
 
 
66
 
67
- wp_register_style(
68
- 'plsfe-frontend',
69
- plugins_url( '/assets/css/plsfe-frontend' . $suffix . '.css', CPEL__FILE__ ),
70
- '',
71
- CPEL_PLUGIN_VERSION
72
- );
73
- } );
 
74
 
75
- } // end method
76
 
77
 
78
  /**
@@ -87,7 +93,7 @@ class Register_Widget {
87
  $this->includes();
88
  $this->register_widget();
89
 
90
- } // end method
91
 
92
 
93
  /**
@@ -99,9 +105,9 @@ class Register_Widget {
99
  */
100
  private function includes() {
101
 
102
- require_once( CPEL_PLUGIN_DIR . 'modules/widgets/polylang-language-switcher.php' );
103
 
104
- } // end method
105
 
106
 
107
  /**
@@ -115,6 +121,6 @@ class Register_Widget {
115
 
116
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Polylang_Language_Switcher() );
117
 
118
- } // end method
119
 
120
- } // end of class
36
 
37
  $this->add_actions();
38
 
39
+ }
40
 
41
 
42
  /**
48
  */
49
  private function add_actions() {
50
 
51
+ add_action( 'elementor/widgets/widgets_registered', array( $this, 'on_widgets_registered' ) );
52
 
53
+ add_action(
54
+ 'elementor/preview/enqueue_styles',
55
+ function() {
56
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
57
 
58
+ wp_enqueue_style(
59
+ 'plsfe-editor',
60
+ plugins_url( '/assets/css/plsfe-editor' . $suffix . '.css', CPEL__FILE__ ),
61
+ '',
62
+ CPEL_PLUGIN_VERSION
63
+ );
64
+ }
65
+ );
66
 
67
+ add_action(
68
+ 'elementor/frontend/after_enqueue_styles',
69
+ function() {
70
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
71
 
72
+ wp_register_style(
73
+ 'plsfe-frontend',
74
+ plugins_url( '/assets/css/plsfe-frontend' . $suffix . '.css', CPEL__FILE__ ),
75
+ '',
76
+ CPEL_PLUGIN_VERSION
77
+ );
78
+ }
79
+ );
80
 
81
+ }
82
 
83
 
84
  /**
93
  $this->includes();
94
  $this->register_widget();
95
 
96
+ }
97
 
98
 
99
  /**
105
  */
106
  private function includes() {
107
 
108
+ require_once CPEL_PLUGIN_DIR . 'modules/widgets/polylang-language-switcher.php';
109
 
110
+ }
111
 
112
 
113
  /**
121
 
122
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Polylang_Language_Switcher() );
123
 
124
+ }
125
 
126
+ }