WF Cookie Consent - Version 0.8.7

Version Description

Improved compatibility with other plugins and themes

Download this release

Release Info

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

Code changes from version 0.8.6 to 0.8.7

Files changed (2) hide show
  1. readme.txt +4 -1
  2. wf-cookie-consent.php +51 -44
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.8.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -29,6 +29,9 @@ WF Cookie Consent is the "wunderfarm-way" to show how your website complies with
29
 
30
  == Changelog ==
31
 
 
 
 
32
  = 0.8.6 =
33
  Bugfix: Set cookie path (thx for the bug report adfasyxcv!)
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.8.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
29
 
30
  == Changelog ==
31
 
32
+ = 0.8.7 =
33
+ Improved compatibility with other plugins and themes
34
+
35
  = 0.8.6 =
36
  Bugfix: Set cookie path (thx for the bug report adfasyxcv!)
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.8.6
7
  License: GNU General Public License v2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Author: wunderfarm
@@ -56,9 +56,9 @@
56
  */
57
 
58
  // add the admin options page
59
- add_action('admin_menu', 'wf_admin_add_page');
60
 
61
- function wf_admin_add_page() {
62
  add_options_page('WF Cookie Consent Settings', 'WF Cookie Consent', 'manage_options', 'wf-cookieconsent', 'wf_cookieconsent_options_page');
63
  }
64
 
@@ -83,24 +83,24 @@ function wf_cookieconsent_options_page(){
83
  }
84
 
85
  // add the admin settings and such
86
- add_action('admin_init', 'wf_admin_init');
87
 
88
- function wf_admin_init(){
89
  register_setting( 'wf_cookieconsent_options', 'wf_cookieconsent_options' );
90
 
91
  add_settings_section('plugin_main', 'General settings', '', 'wf-cookieconsent');
92
- add_settings_field('wf_position', esc_html__('Position'), 'wf_setting_radio', 'wf-cookieconsent', 'plugin_main', array( 'fieldname' => 'wf_position', 'fielddescription' => 'Choose the position for the infobar', 'radioFields' => array( 'top' , 'bottom') ) );
93
 
94
  foreach(wf_get_languages() as $lang){
95
  add_settings_section('plugin_main_' . $lang, 'Custom settings (' . $lang . ')', '', 'wf-cookieconsent');
96
- add_settings_field('wf_linkhref', esc_html__('Page to provide more information'), 'wf_setting_page_selector', 'wf-cookieconsent', 'plugin_main_' . $lang, array( 'fieldname' => 'wf_linkhref', 'fielddescription' => '', 'lang' => $lang ) );
97
- add_settings_field('wf_linktext', esc_html__('Link text to provide more information'), 'wf_setting_string', 'wf-cookieconsent', 'plugin_main_' . $lang, array( 'fieldname' => 'wf_linktext', 'fielddescription' => '', 'lang' => $lang ) );
98
- add_settings_field('wf_cookietext', esc_html__('Info text'), 'wf_setting_string', 'wf-cookieconsent', 'plugin_main_' . $lang, array( 'fieldname' => 'wf_cookietext', 'fielddescription' => '', 'lang' => $lang ) );
99
- add_settings_field('wf_dismisstext', esc_html__('Dismiss text'), 'wf_setting_string', 'wf-cookieconsent', 'plugin_main_' . $lang, array( 'fieldname' => 'wf_dismisstext', 'fielddescription' => '', 'lang' => $lang ) );
100
  }
101
  }
102
 
103
- function wf_setting_string($args) {
104
  $options = get_option('wf_cookieconsent_options');
105
 
106
  if(empty($options[$args['lang']][$args['fieldname']]))
@@ -110,7 +110,7 @@ function wf_setting_string($args) {
110
  echo (empty($args['fielddescription']) ? '' : "<p class='description'>". $args['fielddescription'] ."</p>");
111
  }
112
 
113
- function wf_setting_page_selector($args) {
114
  $options = get_option('wf_cookieconsent_options');
115
 
116
  if(empty($options[$args['lang']][$args['fieldname']]))
@@ -123,7 +123,7 @@ function wf_setting_page_selector($args) {
123
  echo (empty($args['fielddescription']) ? '' : "<p class='description'>". $args['fielddescription'] ."</p>");
124
  }
125
 
126
- function wf_setting_radio($args) {
127
  $options = get_option('wf_cookieconsent_options');
128
 
129
  if(empty($options[$args['fieldname']]))
@@ -143,43 +143,50 @@ function wf_setting_radio($args) {
143
  /*
144
  * Helpers
145
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
 
147
- function wf_get_language() {
148
- $language = null;
149
- //get language from polylang plugin https://wordpress.org/plugins/polylang/
150
- if(function_exists('pll_current_language'))
151
- $language = pll_current_language();
152
- //get language from wpml plugin https://wpml.org
153
- elseif(defined('ICL_LANGUAGE_CODE'))
154
- $language = ICL_LANGUAGE_CODE;
155
- //return wp get_locale() - first 2 chars (en, it, de ...)
156
- else
157
- $language = substr(get_locale(),0,2);
158
-
159
- return $language;
160
  }
161
 
162
- function wf_get_languages() {
163
- $languages = null;
164
- //get all languages from polylang plugin https://wordpress.org/plugins/polylang/
165
- global $polylang;
166
- if (isset($polylang)) {
167
- $pl_languages = $polylang->model->get_languages_list();
168
- foreach ($pl_languages as $pl_language) {
169
- $languages[] = $pl_language->slug;
 
 
 
 
 
 
 
 
 
170
  }
171
- } else if(function_exists('icl_get_languages')) {
172
- //icl_get_languages for wpml
173
- $wpml_languages = icl_get_languages();
174
- foreach ($wpml_languages as $wpml_language) {
175
- $languages[] = $wpml_language['language_code'];
176
  }
 
177
  }
178
- else {
179
- //return wp get_locale() - first 2 chars (en, it, de ...)
180
- $languages[] = substr(get_locale(),0,2);
181
- }
182
- return $languages;
183
  }
184
 
185
  ?>
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.8.7
7
  License: GNU General Public License v2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Author: wunderfarm
56
  */
57
 
58
  // add the admin options page
59
+ add_action('admin_menu', 'wf_cookieconsent_admin_add_page');
60
 
61
+ function wf_cookieconsent_admin_add_page() {
62
  add_options_page('WF Cookie Consent Settings', 'WF Cookie Consent', 'manage_options', 'wf-cookieconsent', 'wf_cookieconsent_options_page');
63
  }
64
 
83
  }
84
 
85
  // add the admin settings and such
86
+ add_action('admin_init', 'wf_cookieconsent_admin_init');
87
 
88
+ function wf_cookieconsent_admin_init(){
89
  register_setting( 'wf_cookieconsent_options', 'wf_cookieconsent_options' );
90
 
91
  add_settings_section('plugin_main', 'General settings', '', 'wf-cookieconsent');
92
+ add_settings_field('wf_position', esc_html__('Position'), 'wf_cookieconsent_setting_radio', 'wf-cookieconsent', 'plugin_main', array( 'fieldname' => 'wf_position', 'fielddescription' => 'Choose the position for the infobar', 'radioFields' => array( 'top' , 'bottom') ) );
93
 
94
  foreach(wf_get_languages() as $lang){
95
  add_settings_section('plugin_main_' . $lang, 'Custom settings (' . $lang . ')', '', 'wf-cookieconsent');
96
+ add_settings_field('wf_linkhref', esc_html__('Page to provide more information'), 'wf_cookieconsent_setting_page_selector', 'wf-cookieconsent', 'plugin_main_' . $lang, array( 'fieldname' => 'wf_linkhref', 'fielddescription' => '', 'lang' => $lang ) );
97
+ add_settings_field('wf_linktext', esc_html__('Link text to provide more information'), 'wf_cookieconsent_setting_string', 'wf-cookieconsent', 'plugin_main_' . $lang, array( 'fieldname' => 'wf_linktext', 'fielddescription' => '', 'lang' => $lang ) );
98
+ add_settings_field('wf_cookietext', esc_html__('Info text'), 'wf_cookieconsent_setting_string', 'wf-cookieconsent', 'plugin_main_' . $lang, array( 'fieldname' => 'wf_cookietext', 'fielddescription' => '', 'lang' => $lang ) );
99
+ add_settings_field('wf_dismisstext', esc_html__('Dismiss text'), 'wf_cookieconsent_setting_string', 'wf-cookieconsent', 'plugin_main_' . $lang, array( 'fieldname' => 'wf_dismisstext', 'fielddescription' => '', 'lang' => $lang ) );
100
  }
101
  }
102
 
103
+ function wf_cookieconsent_setting_string($args) {
104
  $options = get_option('wf_cookieconsent_options');
105
 
106
  if(empty($options[$args['lang']][$args['fieldname']]))
110
  echo (empty($args['fielddescription']) ? '' : "<p class='description'>". $args['fielddescription'] ."</p>");
111
  }
112
 
113
+ function wf_cookieconsent_setting_page_selector($args) {
114
  $options = get_option('wf_cookieconsent_options');
115
 
116
  if(empty($options[$args['lang']][$args['fieldname']]))
123
  echo (empty($args['fielddescription']) ? '' : "<p class='description'>". $args['fielddescription'] ."</p>");
124
  }
125
 
126
+ function wf_cookieconsent_setting_radio($args) {
127
  $options = get_option('wf_cookieconsent_options');
128
 
129
  if(empty($options[$args['fieldname']]))
143
  /*
144
  * Helpers
145
  */
146
+ if (!function_exists('wf_get_language')) {
147
+
148
+ function wf_get_language() {
149
+ $language = null;
150
+ //get language from polylang plugin https://wordpress.org/plugins/polylang/
151
+ if(function_exists('pll_current_language'))
152
+ $language = pll_current_language();
153
+ //get language from wpml plugin https://wpml.org
154
+ elseif(defined('ICL_LANGUAGE_CODE'))
155
+ $language = ICL_LANGUAGE_CODE;
156
+ //return wp get_locale() - first 2 chars (en, it, de ...)
157
+ else
158
+ $language = substr(get_locale(),0,2);
159
+
160
+ return $language;
161
+ }
162
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  }
164
 
165
+ if (!function_exists('wf_get_languages')) {
166
+
167
+ function wf_get_languages() {
168
+ $languages = null;
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();
179
+ foreach ($wpml_languages as $wpml_language) {
180
+ $languages[] = $wpml_language['language_code'];
181
+ }
182
  }
183
+ else {
184
+ //return wp get_locale() - first 2 chars (en, it, de ...)
185
+ $languages[] = substr(get_locale(),0,2);
 
 
186
  }
187
+ return $languages;
188
  }
189
+
 
 
 
 
190
  }
191
 
192
  ?>