* @version $Id$ * @access public * @license http://opensource.org/licenses/gpl-3.0.html */ global $plug; $options = $plug->retrieveValues($GLOBALS['sql_object']); isset($options['linkto']) ? $moreinfo = $options['linkto'] : $moreinfo = 'http://www.aboutcookies.org/'; isset($options['title']) ? $title = $options['title'] : $title = _t('cookieRGPD', 'title'); isset($options['message']) ? $message = $options['message'] : $message = _t('cookieRGPD', 'default-message'); isset($options['expires']) ? $expires = $options['expires'] : $expires = 365; isset($options['delay']) ? $delay = $options['delay'] : $delay = 1000; isset($options['stats']) ? $stats = 'true' : $stats = 'false'; isset($options['marketing']) ? $marketing = 'true' : $marketing = 'false'; headerAddCSS ( $plug->getVar ( 'relative_url' ) . 'css/style.css' ); // We prepare the JS content to embed // data-expires="31536000" is supposed to make cookie expires after 1 year (in seconds) //$js = ''; footerAddInlineJS($js, 'default', false); $sep = ''; $cookieTypes = ''; if($stats == 'true') $cookieTypes .= '{ type: "'._t('cookieRGPD', 'analyticsCookieTypeLabel').'", value: "analytics", description: "'._t('cookieRGPD', 'analyticsCookieTypeDesc').'" }'; if(!empty($cookieTypes)) $sep = ",\n"; if($marketing == 'true') $cookieTypes .= $sep . '{ type: "'._t('cookieRGPD', 'marketingCookieTypeLabel').'", value: "marketing", description: "'._t('cookieRGPD', 'marketingCookieTypeDesc').'" }'; $js = ' // Or with customised options var options = { expires: '.$expires.', delay: '.$delay.', title: "'.$title.'", message: "'.$message.'", link: "'.$moreinfo.'", moreInfoLabel: "'._t('cookieRGPD', 'learn-more').'", acceptBtnLabel: "'._t('cookieRGPD', 'got-it').'", advancedBtnLabel: "'._t('cookieRGPD', 'settings').'", cookieTypesTitle: "'._t('cookieRGPD', 'select').'", fixedCookieTypeLabel: "'._t('cookieRGPD', 'fixedCookieTypeLabel').'", fixedCookieTypeDesc: "'._t('cookieRGPD', 'fixedCookieTypeDesc').'", cookieTypes: [ '.$cookieTypes.' ] } $("body").ihavecookies(options); '; footerAddInlineJS($js, 'default', true); // adding ability to manage cookies in profile page if(CURRENT_APP == 'public' && isset($_REQUEST['rub']) && ActiveItemKey($_REQUEST['rub']) == 'user-prefs') { $js = "$('#see-profile').append('" . _t('cookieRGPD', 'handleCookies') . "'); $('a#ihavecookiesBtn').click(function(){ $('body').ihavecookies(options, 'reinit'); return false; });"; footerAddInlineJS($js, 'default', true); }