Version Description
Bugfix: Compatibility with Polylang and WPML.
Download this release
Release Info
Developer | wunderfarm |
Plugin | WF Cookie Consent |
Version | 0.9.2 |
Comparing to | |
See all releases |
Code changes from version 0.9.1 to 0.9.2
- readme.txt +5 -2
- wf-cookie-consent.php +48 -23
readme.txt
CHANGED
@@ -4,11 +4,11 @@ Donate link: http://wunderfarm.com/
|
|
4 |
Tags: compliance, cookie law, cookielaw, cookies, cookiebar, policy, bar, eu cookie law, cookie law banner, cookiechoices, eu privacy directive, privacy, privacy directive, cookie consent, cookieconsent, Multi language, WPML, polylang, responsive, admin, code, content, embed, google, html, integration, javascript, links, login, marketing, page, pages, plugin, simple, text, url, wordpress, law,
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 4.2.2
|
7 |
-
Stable tag: 0.9.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
-
The `wunderfarm-way` to show how your website complies with the EU Cookie Law - 100% responsive and with multi-language support
|
12 |
|
13 |
== Description ==
|
14 |
|
@@ -29,6 +29,9 @@ WF Cookie Consent is the "wunderfarm-way" to show how your website complies with
|
|
29 |
|
30 |
== Changelog ==
|
31 |
|
|
|
|
|
|
|
32 |
= 0.9.1 =
|
33 |
Improved compatibility with Polylang and WPML.
|
34 |
|
4 |
Tags: compliance, cookie law, cookielaw, cookies, cookiebar, policy, bar, eu cookie law, cookie law banner, cookiechoices, eu privacy directive, privacy, privacy directive, cookie consent, cookieconsent, Multi language, WPML, polylang, responsive, admin, code, content, embed, google, html, integration, javascript, links, login, marketing, page, pages, plugin, simple, text, url, wordpress, law,
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 4.2.2
|
7 |
+
Stable tag: 0.9.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
+
The `wunderfarm-way` to show how your website complies with the EU Cookie Law - 100% responsive and with multi-language support.
|
12 |
|
13 |
== Description ==
|
14 |
|
29 |
|
30 |
== Changelog ==
|
31 |
|
32 |
+
= 0.9.2 =
|
33 |
+
Bugfix: Compatibility with Polylang and WPML.
|
34 |
+
|
35 |
= 0.9.1 =
|
36 |
Improved compatibility with Polylang and WPML.
|
37 |
|
wf-cookie-consent.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WF Cookie Consent
|
4 |
Plugin URI: http://www.wunderfarm.com/plugins/wf-cookie-consent
|
5 |
Description: The wunderfarm-way to show how your website complies with the EU Cookie Law.
|
6 |
-
Version: 0.9.
|
7 |
License: GNU General Public License v2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
Author: wunderfarm
|
@@ -116,10 +116,28 @@ function wf_cookieconsent_setting_page_selector($args) {
|
|
116 |
if(empty($options[$args['lang']][$args['fieldname']]))
|
117 |
$options[$args['lang']][$args['fieldname']] = '';
|
118 |
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
echo (empty($args['fielddescription']) ? '' : "<p class='description'>". $args['fielddescription'] ."</p>");
|
124 |
}
|
125 |
|
@@ -169,26 +187,16 @@ if (!function_exists('wf_get_languages')) {
|
|
169 |
//get all languages from polylang plugin https://wordpress.org/plugins/polylang/
|
170 |
global $polylang;
|
171 |
if (isset($polylang)) {
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
$languages[] = $pl_language->slug;
|
177 |
-
}
|
178 |
-
} else {
|
179 |
-
//get selected language
|
180 |
-
$languages[] = pll_current_language();
|
181 |
}
|
182 |
} else if(function_exists('icl_get_languages')) {
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
$languages[] = $wpml_language['language_code'];
|
188 |
-
}
|
189 |
-
} else {
|
190 |
-
//get selected language
|
191 |
-
$languages[] = ICL_LANGUAGE_CODE;
|
192 |
}
|
193 |
}
|
194 |
else {
|
@@ -200,4 +208,21 @@ if (!function_exists('wf_get_languages')) {
|
|
200 |
|
201 |
}
|
202 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
?>
|
3 |
Plugin Name: WF Cookie Consent
|
4 |
Plugin URI: http://www.wunderfarm.com/plugins/wf-cookie-consent
|
5 |
Description: The wunderfarm-way to show how your website complies with the EU Cookie Law.
|
6 |
+
Version: 0.9.2
|
7 |
License: GNU General Public License v2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
Author: wunderfarm
|
116 |
if(empty($options[$args['lang']][$args['fieldname']]))
|
117 |
$options[$args['lang']][$args['fieldname']] = '';
|
118 |
|
119 |
+
$wf_page_query = new WP_Query( array(
|
120 |
+
'post_type' => 'page',
|
121 |
+
'suppress_filters' => true, // With this option, WPML will not use any filter
|
122 |
+
'orderby' => 'menu_order',
|
123 |
+
'order'=>'desc',
|
124 |
+
'lang'=>'all' // With this option, Polylang will return all languages
|
125 |
+
) );
|
126 |
+
|
127 |
+
echo "<select name='wf_cookieconsent_options[".$args['lang']."][".$args['fieldname']."]' id='wf_cookieconsent_options[".$args['lang']."][".$args['fieldname']."]'>";
|
128 |
+
foreach ( $wf_page_query->posts as $post ) {
|
129 |
+
$wf_language_information = wf_get_language_information($post->ID);
|
130 |
+
if(!empty($wf_language_information))
|
131 |
+
$wf_language_information = "(" . $wf_language_information . ")";
|
132 |
+
|
133 |
+
if($options[$args['lang']][$args['fieldname']] == $post->ID)
|
134 |
+
echo "<option class='level-0' value='" . $post->ID . "' selected='selected'>" . $post->post_title . " " . $wf_language_information . "</option>";
|
135 |
+
else
|
136 |
+
echo "<option class='level-0' value='" . $post->ID . "'>" . $post->post_title . " " . $wf_language_information . "</option>";
|
137 |
+
|
138 |
+
}
|
139 |
+
echo "</select>";
|
140 |
+
|
141 |
echo (empty($args['fielddescription']) ? '' : "<p class='description'>". $args['fielddescription'] ."</p>");
|
142 |
}
|
143 |
|
187 |
//get all languages from polylang plugin https://wordpress.org/plugins/polylang/
|
188 |
global $polylang;
|
189 |
if (isset($polylang)) {
|
190 |
+
//get all languages
|
191 |
+
$pl_languages = $polylang->model->get_languages_list();
|
192 |
+
foreach ($pl_languages as $pl_language) {
|
193 |
+
$languages[] = $pl_language->slug;
|
|
|
|
|
|
|
|
|
|
|
194 |
}
|
195 |
} else if(function_exists('icl_get_languages')) {
|
196 |
+
//get all languages with icl_get_languages for wpml
|
197 |
+
$wpml_languages = icl_get_languages('skip_missing=0');
|
198 |
+
foreach ($wpml_languages as $wpml_language) {
|
199 |
+
$languages[] = $wpml_language['language_code'];
|
|
|
|
|
|
|
|
|
|
|
200 |
}
|
201 |
}
|
202 |
else {
|
208 |
|
209 |
}
|
210 |
|
211 |
+
if (!function_exists('wf_get_language_information')) {
|
212 |
+
|
213 |
+
function wf_get_language_information($post_id) {
|
214 |
+
$locale = '';
|
215 |
+
|
216 |
+
if (function_exists('pll_get_post_language')) {
|
217 |
+
$locale = pll_get_post_language($post_id);
|
218 |
+
} else if (function_exists('wpml_get_language_information')) {
|
219 |
+
$language_information = wpml_get_language_information($post_id);
|
220 |
+
$locale = $language_information['display_name'];
|
221 |
+
}
|
222 |
+
|
223 |
+
return $locale;
|
224 |
+
}
|
225 |
+
|
226 |
+
}
|
227 |
+
|
228 |
?>
|