WF Cookie Consent - Version 0.9.1

Version Description

Improved compatibility with Polylang and WPML.

Download this release

Release Info

Developer wunderfarm
Plugin Icon 128x128 WF Cookie Consent
Version 0.9.1
Comparing to
See all releases

Code changes from version 0.9.0 to 0.9.1

Files changed (2) hide show
  1. readme.txt +5 -2
  2. wf-cookie-consent.php +21 -10
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -29,8 +29,11 @@ WF Cookie Consent is the "wunderfarm-way" to show how your website complies with
29
 
30
  == Changelog ==
31
 
 
 
 
32
  = 0.9.0 =
33
- Bugfix: For website using earlier versions of WPML.
34
 
35
  = 0.8.9 =
36
  Bugfix: Include js file.
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.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
29
 
30
  == Changelog ==
31
 
32
+ = 0.9.1 =
33
+ Improved compatibility with Polylang and WPML.
34
+
35
  = 0.9.0 =
36
+ Bugfix: For websites using earlier versions of WPML.
37
 
38
  = 0.8.9 =
39
  Bugfix: Include js file.
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.0
7
  License: GNU General Public License v2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Author: wunderfarm
@@ -105,8 +105,8 @@ function wf_cookieconsent_setting_string($args) {
105
 
106
  if(empty($options[$args['lang']][$args['fieldname']]))
107
  $options[$args['lang']][$args['fieldname']] = '';
108
-
109
- echo "<input id='plugin_text_string' name='wf_cookieconsent_options[{$args['lang']}][{$args['fieldname']}]' size='40' type='text' value='{$options[$args['lang']][$args['fieldname']]}' />";
110
  echo (empty($args['fielddescription']) ? '' : "<p class='description'>". $args['fielddescription'] ."</p>");
111
  }
112
 
@@ -169,15 +169,26 @@ 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
- $pl_languages = $polylang->model->get_languages_list();
173
- foreach ($pl_languages as $pl_language) {
174
- $languages[] = $pl_language->slug;
 
 
 
 
 
 
175
  }
176
  } else if(function_exists('icl_get_languages')) {
177
- //icl_get_languages for wpml
178
- $wpml_languages = icl_get_languages('skip_missing=0');
179
- foreach ($wpml_languages as $wpml_language) {
180
- $languages[] = $wpml_language['language_code'];
 
 
 
 
 
181
  }
182
  }
183
  else {
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.1
7
  License: GNU General Public License v2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Author: wunderfarm
105
 
106
  if(empty($options[$args['lang']][$args['fieldname']]))
107
  $options[$args['lang']][$args['fieldname']] = '';
108
+ $esc_value = esc_attr($options[$args['lang']][$args['fieldname']]);
109
+ echo "<input id='plugin_text_string' name='wf_cookieconsent_options[{$args['lang']}][{$args['fieldname']}]' size='40' type='text' value='{$esc_value}' />";
110
  echo (empty($args['fielddescription']) ? '' : "<p class='description'>". $args['fielddescription'] ."</p>");
111
  }
112
 
169
  //get all languages from polylang plugin https://wordpress.org/plugins/polylang/
170
  global $polylang;
171
  if (isset($polylang)) {
172
+ if(!function_exists('pll_current_language') || pll_current_language() == false) {
173
+ //get all languages
174
+ $pl_languages = $polylang->model->get_languages_list();
175
+ foreach ($pl_languages as $pl_language) {
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
+ if (!defined('ICL_LANGUAGE_CODE') || ICL_LANGUAGE_CODE == 'all') {
184
+ //get all languages with icl_get_languages for wpml
185
+ $wpml_languages = icl_get_languages('skip_missing=0');
186
+ foreach ($wpml_languages as $wpml_language) {
187
+ $languages[] = $wpml_language['language_code'];
188
+ }
189
+ } else {
190
+ //get selected language
191
+ $languages[] = ICL_LANGUAGE_CODE;
192
  }
193
  }
194
  else {