WF Cookie Consent - Version 0.9.9

Version Description

Compatibility for Polylang Version 1.8

Download this release

Release Info

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

Code changes from version 0.9.8 to 0.9.9

Files changed (2) hide show
  1. readme.txt +11 -8
  2. wf-cookie-consent.php +31 -23
readme.txt CHANGED
@@ -1,19 +1,19 @@
1
  === Plugin Name ===
2
  Contributors: wunderfarm
3
  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.4
7
- Stable tag: 0.9.8
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
 
15
- WF Cookie Consent shows the user a clear message that the site uses cookies.
16
- This plugin supports multi-language installations with the polylang-plugin from Chouby or WPML-plugin from wpml.org. It has a wide array of settings for controlling the style and contents.
17
  WF Cookie Consent is the "wunderfarm-way" to show how your website complies with the EU Cookie Law.
18
 
19
  == Installation ==
@@ -29,14 +29,17 @@ WF Cookie Consent is the "wunderfarm-way" to show how your website complies with
29
 
30
  == Changelog ==
31
 
 
 
 
32
  = 0.9.8 =
33
- Added compatibility for WPML Version: 3.2 and above
34
 
35
  = 0.9.7 =
36
  Improved compatibility with WPML Multilingual CMS 3.2.6
37
 
38
  = 0.9.5 =
39
- Added compatibility for IE8 and previous IE versions
40
 
41
  = 0.9.4 =
42
  Bugfix: The page-selector is now showing all entries.
1
  === Plugin Name ===
2
  Contributors: wunderfarm
3
  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, lightweight,
5
  Requires at least: 3.0.1
6
+ Tested up to: 4.5
7
+ Stable tag: 0.9.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 - very easy, 100% responsive and with multi-language support!
12
 
13
  == Description ==
14
 
15
+ WF Cookie Consent shows the user a clear message that the site uses cookies.
16
+ This plugin supports multi-language installations with the polylang-plugin from Chouby or WPML-plugin from wpml.org. It has a wide array of settings for controlling the style and contents.
17
  WF Cookie Consent is the "wunderfarm-way" to show how your website complies with the EU Cookie Law.
18
 
19
  == Installation ==
29
 
30
  == Changelog ==
31
 
32
+ = 0.9.9 =
33
+ Compatibility for Polylang Version 1.8
34
+
35
  = 0.9.8 =
36
+ Compatibility for WPML Version 3.2 and above
37
 
38
  = 0.9.7 =
39
  Improved compatibility with WPML Multilingual CMS 3.2.6
40
 
41
  = 0.9.5 =
42
+ Compatibility for IE8 and previous IE versions
43
 
44
  = 0.9.4 =
45
  Bugfix: The page-selector is now showing all entries.
wf-cookie-consent.php CHANGED
@@ -1,9 +1,9 @@
1
- <?php
2
  /*
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.8
7
  License: GNU General Public License v2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Author: wunderfarm
@@ -21,7 +21,7 @@
21
  wp_enqueue_script( 'wf-cookiechoices', plugin_dir_url( __FILE__ ) . 'js/cookiechoices.js', array(), '0.0.4', true );
22
 
23
  }
24
-
25
  add_action( 'wp_enqueue_scripts', 'wf_cookieconsent_scripts' );
26
 
27
  /*
@@ -40,7 +40,7 @@
40
 
41
  if(is_numeric($linkHref))
42
  $linkHref = get_page_link($linkHref);
43
-
44
  ?>
45
  <script type="text/javascript">
46
 
@@ -52,7 +52,7 @@
52
  document.addEventListener('DOMContentLoaded', cookieBar);
53
  }
54
  else {
55
- document.attachEvent('onreadystatechange', function(event) {
56
  if ( document.readyState === "complete" ) {
57
  cookieBar();
58
  }
@@ -89,12 +89,12 @@ function wf_cookieconsent_options_page(){
89
  <form action="options.php" method="post">
90
  <?php settings_fields('wf_cookieconsent_options'); ?>
91
  <?php do_settings_sections('wf-cookieconsent'); ?>
92
-
93
  <input name="Submit" type="submit" class="button button-primary" value="<?php esc_attr_e('Save Changes'); ?>" />
94
  </form>
95
  </div>
96
 
97
- <?php
98
 
99
  }
100
 
@@ -118,7 +118,7 @@ function wf_cookieconsent_admin_init(){
118
 
119
  function wf_cookieconsent_setting_string($args) {
120
  $options = get_option('wf_cookieconsent_options');
121
-
122
  if(empty($options[$args['lang']][$args['fieldname']]))
123
  $options[$args['lang']][$args['fieldname']] = '';
124
  $esc_value = esc_attr($options[$args['lang']][$args['fieldname']]);
@@ -128,14 +128,14 @@ function wf_cookieconsent_setting_string($args) {
128
 
129
  function wf_cookieconsent_setting_page_selector($args) {
130
  $options = get_option('wf_cookieconsent_options');
131
-
132
  if(empty($options[$args['lang']][$args['fieldname']]))
133
  $options[$args['lang']][$args['fieldname']] = '';
134
 
135
- $wf_page_query = new WP_Query( array(
136
  'post_type' => 'page',
137
  'suppress_filters' => true, // With this option, WPML will not use any filter
138
- 'orderby' => 'title',
139
  'order'=>'asc',
140
  'lang'=>'all', // With this option, Polylang will return all languages
141
  'nopaging'=>true
@@ -146,7 +146,7 @@ function wf_cookieconsent_setting_page_selector($args) {
146
  $wf_language_information = wf_get_language_information($post->ID);
147
  if(!empty($wf_language_information))
148
  $wf_language_information = "(" . $wf_language_information . ")";
149
-
150
  if($options[$args['lang']][$args['fieldname']] == $post->ID)
151
  echo "<option class='level-0' value='" . $post->ID . "' selected='selected'>" . $post->post_title . " " . $wf_language_information . "</option>";
152
  else
@@ -160,7 +160,7 @@ function wf_cookieconsent_setting_page_selector($args) {
160
 
161
  function wf_cookieconsent_setting_radio($args) {
162
  $options = get_option('wf_cookieconsent_options');
163
-
164
  if(empty($options[$args['fieldname']]))
165
  $options[$args['fieldname']] = '';
166
 
@@ -203,9 +203,15 @@ if (!function_exists('wf_get_languages')) {
203
  $languages = array();
204
  //get all languages from polylang plugin https://wordpress.org/plugins/polylang/
205
  global $polylang;
206
- if (isset($polylang)) {
207
- //get all languages
 
 
 
208
  $pl_languages = $polylang->model->get_languages_list();
 
 
 
209
  foreach ($pl_languages as $pl_language) {
210
  $languages[] = $pl_language->slug;
211
  }
@@ -229,22 +235,24 @@ if (!function_exists('wf_get_language_information')) {
229
 
230
  function wf_get_language_information($post_id) {
231
  $locale = '';
 
232
  if (function_exists('pll_get_post_language')) {
 
233
  $locale = pll_get_post_language($post_id);
234
  } else if (has_filter('wpml_post_language_details') ) {
 
235
  $language_information = apply_filters( 'wpml_post_language_details', NULL, $post_id ) ;
236
  } else if (function_exists('wpml_get_language_information') ) {
237
- $language_information = wpml_get_language_information($post_id);
 
238
  }
239
-
240
- if(is_wp_error($language_information))
241
- $locale = '';
242
- else
243
- $locale = $language_information['display_name'];
244
-
245
  return $locale;
246
  }
247
 
248
  }
249
 
250
- ?>
1
+ <?php
2
  /*
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.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
21
  wp_enqueue_script( 'wf-cookiechoices', plugin_dir_url( __FILE__ ) . 'js/cookiechoices.js', array(), '0.0.4', true );
22
 
23
  }
24
+
25
  add_action( 'wp_enqueue_scripts', 'wf_cookieconsent_scripts' );
26
 
27
  /*
40
 
41
  if(is_numeric($linkHref))
42
  $linkHref = get_page_link($linkHref);
43
+
44
  ?>
45
  <script type="text/javascript">
46
 
52
  document.addEventListener('DOMContentLoaded', cookieBar);
53
  }
54
  else {
55
+ document.attachEvent('onreadystatechange', function(event) {
56
  if ( document.readyState === "complete" ) {
57
  cookieBar();
58
  }
89
  <form action="options.php" method="post">
90
  <?php settings_fields('wf_cookieconsent_options'); ?>
91
  <?php do_settings_sections('wf-cookieconsent'); ?>
92
+
93
  <input name="Submit" type="submit" class="button button-primary" value="<?php esc_attr_e('Save Changes'); ?>" />
94
  </form>
95
  </div>
96
 
97
+ <?php
98
 
99
  }
100
 
118
 
119
  function wf_cookieconsent_setting_string($args) {
120
  $options = get_option('wf_cookieconsent_options');
121
+
122
  if(empty($options[$args['lang']][$args['fieldname']]))
123
  $options[$args['lang']][$args['fieldname']] = '';
124
  $esc_value = esc_attr($options[$args['lang']][$args['fieldname']]);
128
 
129
  function wf_cookieconsent_setting_page_selector($args) {
130
  $options = get_option('wf_cookieconsent_options');
131
+
132
  if(empty($options[$args['lang']][$args['fieldname']]))
133
  $options[$args['lang']][$args['fieldname']] = '';
134
 
135
+ $wf_page_query = new WP_Query( array(
136
  'post_type' => 'page',
137
  'suppress_filters' => true, // With this option, WPML will not use any filter
138
+ 'orderby' => 'title',
139
  'order'=>'asc',
140
  'lang'=>'all', // With this option, Polylang will return all languages
141
  'nopaging'=>true
146
  $wf_language_information = wf_get_language_information($post->ID);
147
  if(!empty($wf_language_information))
148
  $wf_language_information = "(" . $wf_language_information . ")";
149
+
150
  if($options[$args['lang']][$args['fieldname']] == $post->ID)
151
  echo "<option class='level-0' value='" . $post->ID . "' selected='selected'>" . $post->post_title . " " . $wf_language_information . "</option>";
152
  else
160
 
161
  function wf_cookieconsent_setting_radio($args) {
162
  $options = get_option('wf_cookieconsent_options');
163
+
164
  if(empty($options[$args['fieldname']]))
165
  $options[$args['fieldname']] = '';
166
 
203
  $languages = array();
204
  //get all languages from polylang plugin https://wordpress.org/plugins/polylang/
205
  global $polylang;
206
+ if (function_exists('PLL')) {
207
+ // for polylang versions > 1.8
208
+ $pl_languages = PLL()->model->get_languages_list();
209
+ } else if (isset($polylang)) {
210
+ // for older polylang version
211
  $pl_languages = $polylang->model->get_languages_list();
212
+ }
213
+ if (isset($pl_languages)) {
214
+ // iterate through polylang language list
215
  foreach ($pl_languages as $pl_language) {
216
  $languages[] = $pl_language->slug;
217
  }
235
 
236
  function wf_get_language_information($post_id) {
237
  $locale = '';
238
+ $language_information = '';
239
  if (function_exists('pll_get_post_language')) {
240
+ // for polylang versions > 1.7
241
  $locale = pll_get_post_language($post_id);
242
  } else if (has_filter('wpml_post_language_details') ) {
243
+ // for wpml versions > 3.2
244
  $language_information = apply_filters( 'wpml_post_language_details', NULL, $post_id ) ;
245
  } else if (function_exists('wpml_get_language_information') ) {
246
+ // for older wpml versions
247
+ $language_information = wpml_get_language_information($post_id);
248
  }
249
+ if(is_wp_error($language_information) || empty($language_information))
250
+ $locale = '';
251
+ else
252
+ $locale = $language_information['display_name'];
 
 
253
  return $locale;
254
  }
255
 
256
  }
257
 
258
+ ?>