Commit 10b1d9c6 authored by Robert Lyon's avatar Robert Lyon

Bug 1535519: Upgrading cookieconsent to version 2.0.9

This version simplifies how we deal with cookie consent
All a user has to do is acknowledge that they understand that the site
uses cookies and if they want to know more they can follow the link to
the cookie policy of the site.

Change-Id: I8a757cb09487167b0bc655d75c3625a0e1d7d0d7
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 4843135a
......@@ -38,133 +38,6 @@ $form = pieform(array(
'title' => get_string('cookieconsentenable','cookieconsent'),
'defaultvalue' => $enabled,
),
'generaloptions' => array(
'iconclass' => 'icon icon-cog',
'class' => 'first',
'type' => 'fieldset',
'collapsible' => true,
'collapsed' => ($enabled ? false : true),
'legend' => get_string('generaloptions', 'cookieconsent'),
'elements' => array(
'cookietypes' => array(
'type' => 'checkboxes',
'class' => 'stacked',
'title' => get_string('cookietypes','cookieconsent'),
'description' => get_string('cookietypesdesc','cookieconsent'),
'labelwidth' => 20,
'elements' => array(
'social' => array(
'title' => get_string('cookietypessocial','cookieconsent'),
'value' => 'social',
'defaultvalue' => (in_array('social', $cookietypes) ? 1 : 0),
),
'analytics' => array(
'title' => get_string('cookietypesanalytics','cookieconsent'),
'value' => 'analytics',
'defaultvalue' => (in_array('analytics', $cookietypes) ? 1 : 0),
),
'advertising' => array(
'title' => get_string('cookietypesadvertising','cookieconsent'),
'value' => 'advertising',
'defaultvalue' => (in_array('advertising', $cookietypes) ? 1 : 0),
),
'necessary' => array(
'title' => get_string('cookietypesnecessary','cookieconsent'),
'value' => 'necessary',
'defaultvalue' => 1,
'disabled' => true,
),
)
),
'consentmode' => array(
'type' => 'radio',
'title' => get_string('consentmode','cookieconsent'),
'description' => get_string('consentmodedesc1','cookieconsent') . '<br />'
. get_string('consentmodedesc2','cookieconsent'),
'defaultvalue' => (!empty($configdata['consentmode']) ? hsc($configdata['consentmode']) : 'explicit'),
'options' => array(
'explicit' => get_string('consentmodeexplicit','cookieconsent'),
'implicit' => get_string('consentmodeimplicit','cookieconsent'),
)
),
),
),
'stylingoptions' => array(
'iconclass' => 'icon icon-paint-brush',
'type' => 'fieldset',
'collapsible' => true,
'collapsed' => ($enabled ? false : true),
'legend' => get_string('stylingoptions', 'cookieconsent'),
'elements' => array(
'pluginstyle' => array(
'type' => 'select',
'title' => get_string('pluginstyle','cookieconsent'),
'description' => get_string('pluginstyledesc','cookieconsent'),
'defaultvalue' => (!empty($configdata['pluginstyle']) ? hsc($configdata['pluginstyle']) : 'dark'),
'options' => array(
'dark' => get_string('pluginstyledark','cookieconsent'),
'light' => get_string('pluginstylelight','cookieconsent'),
),
),
'bannerposition' => array(
'type' => 'select',
'title' => get_string('bannerposition','cookieconsent'),
'description' => get_string('bannerpositiondesc','cookieconsent'),
'defaultvalue' => (!empty($configdata['bannerposition']) ? hsc($configdata['bannerposition']) : 'bottom'),
'options' => array(
'top' => get_string('bannerpositiontop','cookieconsent'),
'push' => get_string('bannerpositionpush','cookieconsent'),
'bottom' => get_string('bannerpositionbottom','cookieconsent'),
),
),
'tabposition' => array(
'type' => 'select',
'title' => get_string('tabposition','cookieconsent'),
'description' => get_string('tabpositiondesc','cookieconsent'),
'defaultvalue' => (!empty($configdata['tabposition']) ? hsc($configdata['tabposition']) : 'bottom-right'),
'options' => array(
'bottom-right' => get_string('tabpositionbottomright','cookieconsent'),
'bottom-left' => get_string('tabpositionbottomleft','cookieconsent'),
'vertical-left' => get_string('tabpositionverticalleft','cookieconsent'),
'vertical-right' => get_string('tabpositionverticalright','cookieconsent'),
),
),
'hideprivacytab' => array(
'type' => 'switchbox',
'title' => get_string('hideprivacytab','cookieconsent'),
'description' => get_string('hideprivacytabdesc1','cookieconsent'),
'defaultvalue' => (!empty($configdata['hideprivacytab']) ? hsc($configdata['hideprivacytab']) : false),
),
),
),
'featureoptions' => array(
'iconclass' => 'icon icon-star',
'class' => 'last',
'type' => 'fieldset',
'collapsible' => true,
'collapsed' => ($enabled ? false : true),
'legend' => get_string('featureoptions', 'cookieconsent'),
'elements' => array(
'refreshonconsent' => array(
'type' => 'switchbox',
'title' => get_string('pagerefresh','cookieconsent'),
'description' => get_string('pagerefreshdesc1','cookieconsent'),
'defaultvalue' => (!empty($configdata['refreshonconsent']) ? hsc($configdata['refreshonconsent']) : false),
),
'ignoredonottrack' => array(
'type' => 'switchbox',
'title' => get_string('ignoredonottrack','cookieconsent'),
'description' => get_string('ignoredonottrackdesc1','cookieconsent'),
'defaultvalue' => (!empty($configdata['ignoredonottrack']) ? hsc($configdata['ignoredonottrack']) : false),
),
'usessl' => array(
'type' => 'switchbox',
'title' => get_string('usessl','cookieconsent'),
'description' => get_string('usessldesc1','cookieconsent'),
'defaultvalue' => (!empty($configdata['usessl']) ? hsc($configdata['usessl']) : false),
),
),
),
'submit' => array(
'class' => 'btn-primary',
'type' => 'submit',
......@@ -179,23 +52,13 @@ function cookieconsent_submit(Pieform $form, $values) {
// Save whether the Cookie Consent plugin is enabled
$enabled = $values['enabled'];
set_config('cookieconsent_enabled', $enabled);
// Remove unused values and save Cookie Consent settings
unset($values['enabled']);
unset($values['submit']);
unset($values['sesskey']);
// Disabled checkbox isn't send through HTTP POST request, so
$values['cookietypes'] = array_merge($values['cookietypes'], array('necessary'));
// Save Cookie Consent plugin settings
set_config('cookieconsent_settings', serialize($values));
// Redirect to further installation instructions
if ($enabled) {
$SESSION->add_ok_msg(get_string('cookieconsentenabled', 'cookieconsent'));
redirect(get_config('wwwroot') . 'admin/site/cookieconsent2.php');
}
else {
$SESSION->add_ok_msg(get_string('cookieconsentdisabled', 'cookieconsent'));
redirect(get_config('wwwroot') . 'admin/index.php');
}
redirect(get_config('wwwroot') . 'admin/site/cookieconsent.php');
}
......@@ -207,7 +70,7 @@ $smarty->assign('introtext1', get_string('cookieconsentintro1', 'cookieconsent')
$smarty->assign('introtext2', get_string('cookieconsentintro2', 'cookieconsent'));
$smarty->assign('introtext3', get_string('cookieconsentintro3', 'cookieconsent'));
$smarty->assign('introtext4', get_string('cookieconsentintro4', 'cookieconsent'));
$smarty->assign('introtext5', get_string('cookieconsentintro51', 'cookieconsent', '<a href="http://sitebeam.net/cookieconsent/" target="_blank">', '</a>'));
$smarty->assign('introtext5', get_string('cookieconsentintro52', 'cookieconsent', '<a href="http://sitebeam.net/cookieconsent/">', '</a>'));
// Official EU languages
$smarty->assign('languages', array('BG','CS','DA','DE','EL','EN','ES','ET','FI','FR','HU','IT','LT','LV','MT','NL','PL','PT','RO','SK','SL','SV'));
$smarty->display('admin/site/cookieconsent.tpl');
<?php
/**
*
* @package mahara
* @subpackge admin
* @author Gregor Anzelj
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
* @copyright (C) 2013 Gregor Anzelj <gregor.anzelj@gmail.com>
*
*/
define('INTERNAL', 1);
define('ADMIN', 1);
define('MENUITEM', 'configsite/cookieconsent');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'cookieconsent2');
require(dirname(dirname(dirname(__FILE__))).'/init.php');
define('TITLE', get_string('cookieconsent2', 'cookieconsent'));
define('DEFAULTPAGE', 'home');
$examplesocialbefore = <<<CODE
<pre>
&lt;div id="fb-root"&gt;&lt;/div&gt;
&lt;script type="application/javascript"&gt;(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1&appId=000000000000000";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));&lt;/script&gt;
</pre>
CODE;
$examplesocialafter = <<<CODE
<pre>
&lt;div id="fb-root"&gt;&lt;/div&gt;
&lt;script type="<b>text/plain</b>" class="<b>cc-onconsent-social</b>"&gt;(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1&appId=000000000000000";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));&lt;/script&gt;
</pre>
CODE;
$exampleanalyticsbefore = <<<CODE
<pre>
&lt;script type="application/javascript"&gt;
// &lt;![CDATA[
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-00000000-1']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'application/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
// ]]&gt;
&lt;/script&gt;
</pre>
CODE;
$exampleanalyticsafter = <<<CODE
<pre>
&lt;script type="<b>text/plain</b>" class="<b>cc-onconsent-analytics</b>"&gt;
// &lt;![CDATA[
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-00000000-1']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'application/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
// ]]&gt;
&lt;/script&gt;
</pre>
CODE;
$exampleadvertisingbefore = <<<CODE
<pre>
&lt;script type="application/javascript"&gt;
&lt;!--
google_ad_client = "ca-pub-0000000000000000";
/* test */
google_ad_slot = "0000000000";
google_ad_width = 728;
google_ad_height = 90;
//-->
&lt;/script&gt;
&lt;script type="application/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
</pre>
CODE;
$exampleadvertisingafter = <<<CODE
<pre>
&lt;script type="<b>text/plain</b>" class="<b>cc-onconsent-advertising</b>"&gt;
&lt;!--
google_ad_client = "ca-pub-0000000000000000";
/* test */
google_ad_slot = "0000000000";
google_ad_width = 728;
google_ad_height = 90;
//-->
&lt;/script&gt;
&lt;script type="<b>text/plain</b>" class="<b>cc-onconsent-advertising</b>" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
</pre>
CODE;
$examplenecessarybefore = <<<CODE
<pre>
&lt;script type="application/javascript"&gt;
&lt;!--
google_ad_client = "ca-pub-0000000000000000";
/* test */
google_ad_slot = "0000000000";
google_ad_width = 728;
google_ad_height = 90;
//-->
&lt;/script&gt;
&lt;script type="application/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
</pre>
CODE;
$examplenecessaryafter = <<<CODE
<pre>
&lt;script type="<b>text/plain</b>" class="<b>cc-onconsent-necessary</b>"&gt;
&lt;!--
google_ad_client = "ca-pub-0000000000000000";
/* test */
google_ad_slot = "0000000000";
google_ad_width = 728;
google_ad_height = 90;
//-->
&lt;/script&gt;
&lt;script type="<b>text/plain</b>" class="<b>cc-onconsent-necessary</b>" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
</pre>
CODE;
$data = array(
'social' => array(
'id' => '0',
'title' => get_string('cookietypessocial', 'cookieconsent'),
'item1' => get_string('instructiontext1', 'cookieconsent', get_string('cookietypessocial','cookieconsent'), get_string('example1social','cookieconsent')),
'item2' => get_string('instructiontext2-1', 'cookieconsent'),
'item3' => get_string('instructiontext3', 'cookieconsent', 'cc-onconsent-social'),
'code1' => $examplesocialbefore,
'code2' => $examplesocialafter,
'help1' => get_string('itdidntwork1', 'cookieconsent', 'cc-onconsent-social', 'cc-onconsent-inline-social'),
'help2' => get_string('itdidntwork2', 'cookieconsent', '<a href="http://sitebeam.net/cookieconsent/documentation/code-examples#examples-social" target="_blank">', '</a>', '<a href="http://www.linkedin.com/groups/Cookie-Consent-developers-4980594?trk=groups_management_submission_queue-h-dsc" target="_blank">', '</a>')
),
'analytics' => array(
'id' => '1',
'title' => get_string('cookietypesanalytics', 'cookieconsent'),
'item1' => get_string('instructiontext1', 'cookieconsent', get_string('cookietypesanalytics','cookieconsent'), get_string('example1analytics','cookieconsent')),
'item2' => get_string('instructiontext2-1', 'cookieconsent'),
'item3' => get_string('instructiontext3', 'cookieconsent', 'cc-onconsent-analytics'),
'code1' => $exampleanalyticsbefore,
'code2' => $exampleanalyticsafter,
'help1' => get_string('itdidntwork1', 'cookieconsent', 'cc-onconsent-analytics', 'cc-onconsent-inline-analytics'),
'help2' => get_string('itdidntwork2', 'cookieconsent', '<a href="http://sitebeam.net/cookieconsent/documentation/code-examples#examples-analytics" target="_blank">', '</a>', '<a href="http://www.linkedin.com/groups/Cookie-Consent-developers-4980594?trk=groups_management_submission_queue-h-dsc" target="_blank">', '</a>')
),
'advertising' => array(
'id' => '2',
'title' => get_string('cookietypesadvertising', 'cookieconsent'),
'item1' => get_string('instructiontext1', 'cookieconsent', get_string('cookietypesadvertising','cookieconsent'), get_string('example1advertising','cookieconsent')),
'item2' => get_string('instructiontext2-1', 'cookieconsent'),
'item3' => get_string('instructiontext3', 'cookieconsent', 'cc-onconsent-advertising'),
'code1' => $exampleadvertisingbefore,
'code2' => $exampleadvertisingafter,
'help1' => get_string('itdidntwork1', 'cookieconsent', 'cc-onconsent-advertising', 'cc-onconsent-inline-advertising'),
'help2' => get_string('itdidntwork2', 'cookieconsent', '<a href="http://sitebeam.net/cookieconsent/documentation/code-examples#examples-advertising" target="_blank">', '</a>', '<a href="http://www.linkedin.com/groups/Cookie-Consent-developers-4980594?trk=groups_management_submission_queue-h-dsc" target="_blank">', '</a>')
),
'necessary' => array(
'id' => '3',
'title' => get_string('cookietypesnecessary', 'cookieconsent'),
'item1' => get_string('instructiontext1', 'cookieconsent', get_string('cookietypesnecessary','cookieconsent'), get_string('example1necessary','cookieconsent')),
'item2' => get_string('instructiontext2-1', 'cookieconsent'),
'item3' => get_string('instructiontext3', 'cookieconsent', 'cc-onconsent-necessary'),
'code1' => $examplenecessarybefore,
'code2' => $examplenecessaryafter,
'help1' => get_string('itdidntwork1', 'cookieconsent', 'cc-onconsent-necessary', 'cc-onconsent-inline-necessary'),
'help2' => get_string('itdidntwork2', 'cookieconsent', '<a href="http://sitebeam.net/cookieconsent/documentation/code-examples#examples-necessary" target="_blank">', '</a>', '<a href="http://www.linkedin.com/groups/Cookie-Consent-developers-4980594?trk=groups_management_submission_queue-h-dsc" target="_blank">', '</a>')
)
);
$smarty = smarty();
$smarty->assign('modifications', get_string('additionalmodifications','cookieconsent'));
$smarty->assign('data', $data);
$smarty->display('admin/site/cookieconsent2.tpl');
......@@ -2,16 +2,12 @@ CookieConsent
=============
Name : Cookie Consent
Website: http://sitebeam.net/cookieconsent/
Website: https://silktide.com/tools/cookie-consent/
Author : (C) 2013 Silktide Ltd.
Source : http://sitebeam.net/cookieconsent/documentation/changelog/
Version: 1.0.10
Licence: CookieConsent is GPLv3 licensed (see: http://sitebeam.net/cookieconsent/documentation/licence/)
Source : https://github.com/silktide/cookieconsent2/
Version: 2.0.9
Licence: MIT License (see: https://silktide.com/tools/cookie-consent/docs/license/)
Modifications:
- changed 'plugin.js' line 1525 from 'Open+Sans:400,600:latin' to 'Open+Sans:400,600:latin,latin-ext' to avoid UTF-8 character display issues
- renamed 'style.css' to 'cookieconsent.css' and copied/moved it to htdocs/raw/style
- decrease all font-size properties in 'cookieconsent.css' for smaller text (all changes marked with: /*changed*/)
- changed some height and max-height properties in 'cookieconsent.css' (all changes marked with: /*changed*/)
- Set the cookie's "secure" flag if the page is served via HTTPS
- Altered the parseInt() js calls to return number in base 10
\ No newline at end of file
- renamed 'dark-bottom.css' to 'cookieconsent.scss' and copied/moved it to htdocs/theme/raw/sass
- removed the url target '_blank' for security reasons
\ No newline at end of file
!function(){if(!window.hasCookieConsent){window.hasCookieConsent=!0;var e="cookieconsent_options",t="update_cookieconsent_options",n="cookieconsent_dismissed",i="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/1.0.10/";if(!(document.cookie.indexOf(n)>-1||window.navigator&&window.navigator.CookiesOK)){"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});var o,s={isArray:function(e){var t=Object.prototype.toString.call(e);return"[object Array]"==t},isObject:function(e){return"[object Object]"==Object.prototype.toString.call(e)},each:function(e,t,n,i){if(s.isObject(e)&&!i)for(var o in e)e.hasOwnProperty(o)&&t.call(n,e[o],o,e);else for(var r=0,a=e.length;a>r;r++)t.call(n,e[r],r,e)},merge:function(e,t){e&&s.each(t,function(t,n){s.isObject(t)&&s.isObject(e[n])?s.merge(e[n],t):e[n]=t})},bind:function(e,t){return function(){return e.apply(t,arguments)}},queryObject:function(e,t){var n,i=0,o=e;for(t=t.split(".");(n=t[i++])&&o.hasOwnProperty(n)&&(o=o[n]);)if(i===t.length)return o;return null},setCookie:function(e,t,n,i,o){n=n||365;var s=new Date;s.setDate(s.getDate()+n);var r=[e+"="+t,"expires="+s.toUTCString(),"path="+o||"/"];i&&r.push("domain="+i),document.cookie=r.join(";")},addEventListener:function(e,t,n){e.addEventListener?e.addEventListener(t,n):e.attachEvent("on"+t,n)}},r=function(){var e="data-cc-event",t="data-cc-if",n=function(e,t,i){return s.isArray(t)?s.each(t,function(t){n(e,t,i)}):void(e.addEventListener?e.addEventListener(t,i):e.attachEvent("on"+t,i))},i=function(e,t){return e.replace(/\{\{(.*?)\}\}/g,function(e,n){for(var i,o,r=n.split("||");o=r.shift();){if(o=o.trim(),'"'===o[0])return o.slice(1,o.length-1);if(i=s.queryObject(t,o))return i}return""})},o=function(e){var t=document.createElement("div");return t.innerHTML=e,t.children[0]},r=function(e,t,n){var i=e.parentNode.querySelectorAll("["+t+"]");s.each(i,function(e){var i=e.getAttribute(t);n(e,i)},window,!0)},a=function(t,i){r(t,e,function(e,t){var o=t.split(":"),r=s.queryObject(i,o[1]);n(e,o[0],s.bind(r,i))})},c=function(e,n){r(e,t,function(e,t){var i=s.queryObject(n,t);i||e.parentNode.removeChild(e)})};return{build:function(e,t){s.isArray(e)&&(e=e.join("")),e=i(e,t);var n=o(e);return a(n,t),c(n,t),n}}}(),a={options:{message:"This website uses cookies to ensure you get the best experience on our website. ",dismiss:"Got it!",learnMore:"More info",link:null,target:"_self",container:null,theme:"light-floating",domain:null,path:"/",expiryDays:365,markup:['<div class="cc_banner-wrapper {{containerClasses}}">','<div class="cc_banner cc_container cc_container--open">','<a href="#null" data-cc-event="click:dismiss" class="cc_btn cc_btn_accept_all">{{options.dismiss}}</a>','<p class="cc_message">{{options.message}} <a data-cc-if="options.link" target="{{ options.target }}" class="cc_more_info" href="{{options.link || "#null"}}">{{options.learnMore}}</a></p>','<a class="cc_logo" href="http://silktide.com/cookieconsent">Cookie Consent plugin for the EU cookie law</a>',"</div>","</div>"]},init:function(){var t=window[e];t&&this.setOptions(t),this.setContainer(),this.options.theme?this.loadTheme(this.render):this.render()},setOptionsOnTheFly:function(e){this.setOptions(e),this.render()},setOptions:function(e){s.merge(this.options,e)},setContainer:function(){this.options.container?this.container=document.querySelector(this.options.container):this.container=document.body,this.containerClasses="",navigator.appVersion.indexOf("MSIE 8")>-1&&(this.containerClasses+=" cc_ie8")},loadTheme:function(e){var t=this.options.theme;-1===t.indexOf(".css")&&(t=i+t+".css");var n=document.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=t;var o=!1;n.onload=s.bind(function(){!o&&e&&(e.call(this),o=!0)},this),document.getElementsByTagName("head")[0].appendChild(n)},render:function(){this.element&&this.element.parentNode&&(this.element.parentNode.removeChild(this.element),delete this.element),this.element=r.build(this.options.markup,this),this.container.firstChild?this.container.insertBefore(this.element,this.container.firstChild):this.container.appendChild(this.element)},dismiss:function(e){e.preventDefault&&e.preventDefault(),e.returnValue=!1,this.setDismissedCookie(),this.container.removeChild(this.element)},setDismissedCookie:function(){s.setCookie(n,"yes",this.options.expiryDays,this.options.domain,this.options.path)}},c=!1;(o=function(){c||"complete"!=document.readyState||(a.init(),c=!0,window[t]=s.bind(a.setOptionsOnTheFly,a))})(),s.addEventListener(document,"readystatechange",o)}}}();
\ No newline at end of file
This diff is collapsed.
......@@ -245,12 +245,9 @@
}
function writeCookieContentEditorCollapsed(isCollapsed) {
if (!config['cc_enabled'] || (config['cc_enabled'] && document.cookie.indexOf("cc_necessary") >= 0)) {
document.cookie=cookieName+"="+ (isCollapsed ? '1': '0') +"; expires=Wednesday, 01-Aug-2040 08:00:00 GMT";
}
document.cookie=cookieName+"="+ (isCollapsed ? '1': '0') +"; expires=Wednesday, 01-Aug-2040 08:00:00 GMT";
}
function makeNewBlocksDraggable() {
$('.blocktype-drag').draggable({
......
......@@ -61,109 +61,13 @@ $string['readdirectiveSK'] = 'Read Directive 2009/136/EC in Slovak';
$string['readdirectiveSL'] = 'Read Directive 2009/136/EC in Slovene';
$string['readdirectiveSV'] = 'Read Directive 2009/136/EC in Swedish';
$string['cookieconsentintro4'] = 'In short, this means before somebody can store or retrieve any information from a computer, mobile phone or other device, the user must give informed consent to do so. The intention is to increase the privacy of the end user and prevent organisations from obtaining information about people without them knowing about it.';
$string['cookieconsentintro51'] = 'First enable the %sCookie Consent plugin by Silktide%s below, then set the desired options and save your changes. You will be redirected to another page with detailed instructions of what to modify or how to update your theme header files or the <tt>$cfg->additionalhtmlhead</tt> config setting for Cookie Control to take full effect.';
$string['cookieconsentintro52'] = 'Enable %sCookie Consent%s below. Users will see the Cookie Consent banner at the bottom of their screen with a link to your Privacy page. Pleae make sure you inform your users about your use of cookies there.';
$string['cookieconsentenable'] = 'Enable Cookie Consent';
$string['cookieconsentenabled'] = 'Cookie Consent enabled and settings saved';
$string['cookieconsentenabled'] = 'Cookie Consent enabled';
$string['cookieconsentdisabled'] = 'Cookie Consent disabled';
$string['cookieconsent2'] = 'Additional site modifications';
$string['additionalmodifications'] = 'If you want Cookie Control to take full effect, you will have to modify or update your theme header files or the <tt>$cfg->additionalhtmlhead</tt> config setting.';
$string['instructiontext1'] = 'Find any Javascript elements that set %s cookies. Examples might include %s.';
$string['instructiontext2-1'] = 'Modify the <tt>&lt;script&gt;</tt> tag so that the type attribute is "text/plain" rather than "application/javascript".';
$string['instructiontext3'] = 'Add a class of "%s" to the <tt>&lt;script&gt;</tt> tag.';
$string['example1social'] = 'Facebook buttons and Twitter widgets';
$string['example1analytics'] = 'Google Analytics and StatCounter';
$string['example1advertising'] = 'Google AdSense and other targeted advertising plugins';
$string['example1necessary'] = 'Google AdSense and other targeted advertising plugins';
$string['example'] = 'Example';
$string['examplebefore'] = 'Before:';
$string['exampleafter'] = 'After (changes are in bold):';
$string['itdidntwork'] = 'It didn\'t work.';
$string['itdidntwork1'] = 'First, try substituting <b>%s</b> for <b>%s</b>. This fixes some Javascript plugins which use <tt>document.write()</tt>.';
$string['itdidntwork2'] = 'If this doesn\'t help, %scheck out Cookie Consent code examples page%s or ask for help in the %sCookie Consent LinkedIn group%s.';
$string['generaloptions'] = 'General options';
$string['cookietypes'] = 'Types of cookies';
$string['cookietypesdesc'] = 'Select which types of cookies are in use on your site.';
$string['cookietypessocial'] = 'Social media';
$string['cookietypesanalytics'] = 'Analytics';
$string['cookietypesadvertising'] = 'Advertising';
$string['cookietypesnecessary'] = 'Strictly necessary';
$string['consentmode'] = 'Consent mode';
$string['consentmodedesc1'] = 'Cookie Consent will always use explicit mode when a browser\'s "do not track" setting is enabled (unless overridden in "Feature options" below).';
$string['consentmodedesc2'] = 'The "do not track" setting is enabled by default in the latest versions of Internet Explorer.';
$string['consentmodeexplicit'] = 'Explicit - no cookies will be set until a visitor consents';
$string['consentmodeimplicit'] = 'Implied - set cookies and allow visitors to opt out';
$string['stylingoptions'] = 'Styling options';
$string['pluginstyle'] = 'Style';
$string['pluginstyledesc'] = 'Change the look of Cookie Consent.';
$string['pluginstyledark'] = 'Dark';
$string['pluginstylelight'] = 'Light';
$string['bannerposition'] = 'Banner position';
$string['bannerpositiondesc'] = 'Choose whether the consent banner appears at the top or bottom of the screen.';
$string['bannerpositiontop'] = 'Top';
$string['bannerpositionpush'] = 'Push from top (experimental)';
$string['bannerpositionbottom'] = 'Bottom';
$string['tabposition'] = 'Tab position';
$string['tabpositiondesc'] = 'Choose where the privacy settings tab appears.';
$string['tabpositionbottomright'] = 'Bottom right';
$string['tabpositionbottomleft'] = 'Bottom left';
$string['tabpositionverticalleft'] = 'Left side';
$string['tabpositionverticalright'] = 'Right side';
$string['hideprivacytab'] = 'Hide privacy settings tab';
$string['hideprivacytabdesc1'] = 'If you plan to use your own privacy settings link in-line (e.g. in your theme\'s template), you may wish to turn off the standard privacy settings tab.';
$string['featureoptions'] = 'Feature options';
$string['pagerefresh'] = 'Page refresh';
$string['pagerefreshdesc1'] = 'If you have a server-side application that needs to be aware of the consent to cookies, turning this option on will cause the page to be reloaded after consent has been given.';
$string['ignoredonottrack'] = 'Ignore "do not track"';
$string['ignoredonottrackdesc1'] = 'Turning this option on will mean Cookie Consent ignores any "do not track" headers from the visitor\'s browser.';
$string['usessl'] = 'Use SSL';
$string['usessldesc1'] = 'If any of the pages Cookie Consent appears on use SSL, you will need to turn this option on.';
/* ===== COOKIE CONSENT strings ===== */
/* ----- General ----- */
$string['advertisingDefaultTitle'] = 'Advertising';
$string['socialDefaultTitle'] = 'Social media';
$string['socialDefaultDescription'] = 'Facebook, Twitter and other social websites need to know who you are to work properly.';
$string['analyticsDefaultTitle'] = 'Analytics';
$string['analyticsDefaultDescription'] = 'We anonymously measure your use of this website to improve your experience.';
$string['advertisingDefaultDescription'] = 'Adverts will be chosen for you automatically based on your past behaviour and interests.';
$string['necessaryDefaultTitle'] = 'Strictly necessary';
$string['necessaryDefaultDescription'] = 'Some cookies on this website are strictly necessary and cannot be disabled.';
$string['defaultTitle'] = 'Default cookie title';
$string['defaultDescription'] = 'Default cookie description.';
$string['learnMore'] = 'Learn more';
$string['closeWindow'] = 'Close window';
/* ----- Slide down notification ----- */
$string['notificationTitle'] = 'Your experience on this site will be improved by allowing cookies';
$string['notificationTitleImplicit'] = 'We use cookies to ensure you get the best experience on our website';
$string['customCookie'] = 'This website uses a custom type of cookie which needs specific approval';
$string['seeDetails'] = 'see details';
$string['seeDetailsImplicit'] = 'change your settings';
$string['hideDetails'] = 'hide details';
$string['allowCookies'] = 'Allow cookies';
$string['allowCookiesImplicit'] = 'Close';
$string['allowForAllSites'] = 'Allow for all sites';
$string['savePreference'] = 'Save preference';
$string['saveForAllSites'] = 'Save for all sites';
/* ----- Privacy settings tab ----- */
$string['privacySettings'] = 'Privacy settings';
/* ----- Privacy settings dialog ----- */
$string['privacySettingsDialogTitleA'] = 'Privacy settings';
$string['privacySettingsDialogTitleB'] = 'for this website';
$string['privacySettingsDialogSubtitle'] = 'Some features of this website need your consent to remember who you are.';
$string['changeForAllSitesLink'] = 'Change settings for all websites';
$string['preferenceUseGlobal'] = 'Use global setting';
$string['preferenceConsent'] = 'I consent';
$string['preferenceDecline'] = 'I decline';
$string['notUsingCookies'] = 'This website does not use any cookies.';
/* ----- Global settings dialog ----- */
$string['allSitesSettingsDialogTitleA'] = 'Privacy settings';
$string['allSitesSettingsDialogTitleB'] = 'for all websites';
$string['allSitesSettingsDialogSubtitle'] = 'You may consent to these cookies for all websites that use this plugin.';
$string['backToSiteSettings'] = 'Back to website settings';
$string['preferenceAsk'] = 'Ask me each time';
$string['preferenceAlways'] = 'Always allow';
$string['preferenceNever'] = 'Never allow';
/* ----- CookieConsent2 dialog ----- */
$string['cookieconsentmessage'] = 'This website uses cookies to ensure you get the best experience on our website';
$string['cookieconsentdismiss'] = 'Got it!';
$string['cookieconsentlearnmore'] = 'Learn more';
\ No newline at end of file
......@@ -43,95 +43,23 @@ function get_cookieconsent_code() {
}
}
$values = unserialize(get_config('cookieconsent_settings'));
// To see full list of options go to https://silktide.com/tools/cookie-consent/docs/installation/
$initialisation = json_encode(array(
'cookies' => get_cookieconsent_cookies($values['cookietypes']),
'settings' => get_cookieconsent_settings($values),
'strings' => get_cookieconsent_strings(),
'message' => get_string('cookieconsentmessage', 'cookieconsent'),
'learnMore' => get_string('cookieconsentlearnmore', 'cookieconsent'),
'link' => get_config('wwwroot') . 'privacy.php',
'target' => '_self',
'theme' => $links['raw'],
'dismiss' => get_string('cookieconsentdismiss', 'cookieconsent'),
), JSON_FORCE_OBJECT);
$wwwroot = get_config('wwwroot');
return <<<CODE
<!-- Begin Cookie Consent plugin by Silktide - http://silktide.com/cookieconsent -->
<script type="application/javascript" src="{$wwwroot}js/cookieconsent/plugin.js"></script>
{$stylesheets}
<script type="application/javascript">
// <![CDATA[
cc.initialise({$initialisation});
// ]]>
window.cookieconsent_options = {$initialisation};
</script>
<script type="application/javascript" src="{$wwwroot}js/cookieconsent/cookieconsent.min.js"></script>
<!-- End Cookie Consent plugin -->
CODE;
}
/*
* Returns array of cookies, used by Cookie Consent plugin
*/
function get_cookieconsent_cookies($cookies) {
$result = array();
foreach ($cookies as $cookie) {
$result[$cookie] = array();
}
return $result;
}
/*
* Returns array of settings, used by Cookie Consent plugin
*/
function get_cookieconsent_settings($values) {
return array(
'consenttype' => $values['consentmode'],
'style' => $values['pluginstyle'],
'bannerPosition' => $values['bannerposition'],
'tagPosition' => $values['tabposition'],
'hideprivacysettingstab' => $values['hideprivacytab'],
'refreshOnConsent' => $values['refreshonconsent'],
'ignoreDoNotTrack' => $values['ignoredonottrack'],
'useSSL' => $values['usessl'],
);
}
/*
* Returns array of strings, used by Cookie Consent plugin
*/
function get_cookieconsent_strings() {
return array(
'advertisingDefaultTitle' => get_string('advertisingDefaultTitle','cookieconsent'),