Added info about cookies

This commit is contained in:
Manuel Cillero 2017-10-05 19:38:44 +02:00
parent 262f0b730b
commit 9777b4c1ba
9 changed files with 87 additions and 417 deletions

View file

@ -11,6 +11,7 @@
* Implements hook_menu().
*/
function eu_cookie_compliance_menu() {
$items = array();
$items['admin/settings/eu-cookie-compliance'] = array(
'title' => 'EU Cookie Compliance',
'description' => 'Make your website compliant with the EU Directive on Privacy and Electronic Communications.',
@ -27,8 +28,7 @@ function eu_cookie_compliance_menu() {
* Implements hook_init().
*/
function eu_cookie_compliance_init() {
$enabled = eu_cookie_compliance_get_settings('popup_enabled');
if ($enabled && user_access( 'see EU Cookie Compliance popup' ) ) {
if (eu_cookie_compliance_enabled()) {
$path = drupal_get_path('module', 'eu_cookie_compliance');
drupal_add_css($path . '/css/eu_cookie_compliance.css');
drupal_add_js($path . '/js/eu_cookie_compliance.js', 'module', 'footer');
@ -38,11 +38,10 @@ function eu_cookie_compliance_init() {
/**
* Implements hook_footer().
*/
function eu_cookie_compliance_footer() {
$popup_settings = eu_cookie_compliance_get_settings();
if (!empty($popup_settings['popup_enabled']) && user_access( 'see EU Cookie Compliance popup' )) {
if (eu_cookie_compliance_enabled()) {
global $language;
$popup_settings = eu_cookie_compliance_get_settings();
$popup_text_info = str_replace(array("\r", "\n"), '', $popup_settings['popup_info']['value']);
$popup_text_agreed = str_replace(array("\r", "\n"), '', $popup_settings['popup_agreed']['value']);
$html_info = theme('eu_cookie_compliance_popup_info', check_markup($popup_text_info, $popup_settings['popup_info']['format'], FALSE),$popup_settings['popup_agree_button_message'],$popup_settings['popup_disagree_button_message']);
@ -95,6 +94,21 @@ function eu_cookie_compliance_theme() {
);
}
/**
* Return true if EU Cookie compliance is enabled; false in other case.
*/
function eu_cookie_compliance_enabled() {
global $conf;
if (!empty($conf['eu_cookie_compliance']) && $conf['eu_cookie_compliance']) {
if (eu_cookie_compliance_get_settings('popup_enabled')) {
if (user_access('see EU Cookie Compliance popup')) {
return true;
}
}
}
return false;
}
/**
*
* Retrieves settings from the database for a current language.