diff --git a/functions.php b/functions.php index 7078b92..6395048 100644 --- a/functions.php +++ b/functions.php @@ -233,3 +233,22 @@ return $args; } load_plugin_textdomain('theme-my-login' , get_site_url() . 'wp-content/plugins/theme-my-login/languages/'); + +add_action('wp_head','hook_cookielaw'); + +function hook_cookielaw() +{ + $outputlang = get_bloginfo("language"); + $outputlang = substr($outputlang,0,2); + $message = __("This website uses cookies to improve user experience.",responsive); + $accepttext = __("I Understand",responsive); + $policytext = __("Cookie policy",responsive); + $policyurl = "/" . $outputlang . "/info/policy/"; + $output = "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + echo $output; +} diff --git a/languages/README b/languages/README index b8b5a4c..c30ee9f 100644 --- a/languages/README +++ b/languages/README @@ -4,7 +4,7 @@ Translation management: xgettext --default-domain=responsive --language=PHP --keyword=__ --keyword=_e --keyword=esc_attr_e --sort-by-file --copyright-holder="Silvan Calarco" --package-name=openmamba --package-version=1.0 --msgid-bugs-address="bugs@openmamba.org" ../*.php 2) -msgmerge it.po responsive.po -o it.po +msgmerge it_IT.po responsive.po -o it_IT.po 3) -msgcat it.po | msgfmt -o it.mo - +msgcat it_IT.po | msgfmt -o it_IT.mo - diff --git a/languages/it_IT.mo b/languages/it_IT.mo index 0a1041e..34d2bf3 100644 Binary files a/languages/it_IT.mo and b/languages/it_IT.mo differ diff --git a/languages/it_IT.po b/languages/it_IT.po index 40cdab9..5b1c471 100644 --- a/languages/it_IT.po +++ b/languages/it_IT.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Responsive Theme\n" "Report-Msgid-Bugs-To: bugs@openmamba.org\n" -"POT-Creation-Date: 2015-04-16 11:32+0200\n" +"POT-Creation-Date: 2015-07-11 21:11+0200\n" "PO-Revision-Date: 2014-12-08 16:25+0100\n" "Last-Translator: Silvan Calarco \n" "Language-Team: Italian, Italy\n" @@ -46,19 +46,19 @@ msgstr "Sito web fornito da" msgid "WordPress" msgstr "WordPress" -#: ../functions.php:53 ../functions.php:64 +#: ../functions.php:58 ../functions.php:69 msgid "for" msgstr "per" -#: ../functions.php:55 +#: ../functions.php:60 msgid "File size:" msgstr "Dimensione file:" -#: ../functions.php:56 +#: ../functions.php:61 msgid "Date" msgstr "Data" -#: ../functions.php:66 +#: ../functions.php:71 msgid "" "Sorry, download is temporary unavailable. If the problem persists please " "report the problem." @@ -66,23 +66,35 @@ msgstr "" "Il download non รจ temporaneamente disponibile. Se il problema persiste ti " "ringraziamo se ci puoi segnalare il problema." -#: ../functions.php:146 +#: ../functions.php:152 msgid "More languages..." msgstr "Altre lingue..." -#: ../functions.php:149 +#: ../functions.php:155 msgid "Features" msgstr "Caratteristiche" -#: ../functions.php:153 +#: ../functions.php:159 msgid "Requirements" msgstr "Requisiti" -#: ../functions.php:157 +#: ../functions.php:163 msgid "Preparation" msgstr "Preparazione" -#: ../header-webbuild.php:89 +#: ../functions.php:243 +msgid "This website uses cookies to improve user experience." +msgstr "Questo sito utilizza i cookie per migliorare l'esperienza dell'utente." + +#: ../functions.php:244 +msgid "I Understand" +msgstr "Ho capito" + +#: ../functions.php:245 +msgid "Cookie policy" +msgstr "Informativa sui cookie" + +#: ../header-webbuild.php:101 msgid "↓ Skip to Main Content" msgstr "↓ Salta al contenuto principale" diff --git a/languages/responsive.po b/languages/responsive.po index 79a3acf..f6f3b54 100644 --- a/languages/responsive.po +++ b/languages/responsive.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: openmamba 1.0\n" "Report-Msgid-Bugs-To: bugs@openmamba.org\n" -"POT-Creation-Date: 2015-04-16 11:32+0200\n" +"POT-Creation-Date: 2015-07-11 21:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -47,41 +47,53 @@ msgstr "" msgid "WordPress" msgstr "" -#: ../functions.php:53 ../functions.php:64 +#: ../functions.php:58 ../functions.php:69 msgid "for" msgstr "" -#: ../functions.php:55 +#: ../functions.php:60 msgid "File size:" msgstr "" -#: ../functions.php:56 +#: ../functions.php:61 msgid "Date" msgstr "" -#: ../functions.php:66 +#: ../functions.php:71 msgid "" "Sorry, download is temporary unavailable. If the problem persists please " "report the problem." msgstr "" -#: ../functions.php:146 +#: ../functions.php:152 msgid "More languages..." msgstr "" -#: ../functions.php:149 +#: ../functions.php:155 msgid "Features" msgstr "" -#: ../functions.php:153 +#: ../functions.php:159 msgid "Requirements" msgstr "" -#: ../functions.php:157 +#: ../functions.php:163 msgid "Preparation" msgstr "" -#: ../header-webbuild.php:89 +#: ../functions.php:243 +msgid "This website uses cookies to improve user experience." +msgstr "" + +#: ../functions.php:244 +msgid "I Understand" +msgstr "" + +#: ../functions.php:245 +msgid "Cookie policy" +msgstr "" + +#: ../header-webbuild.php:101 msgid "↓ Skip to Main Content" msgstr "" diff --git a/scripts/jquery.cookiebar.js b/scripts/jquery.cookiebar.js new file mode 100644 index 0000000..3ef34ce --- /dev/null +++ b/scripts/jquery.cookiebar.js @@ -0,0 +1,190 @@ +/* + * Copyright (C) 2012 PrimeBox (info@primebox.co.uk) + * + * This work is licensed under the Creative Commons + * Attribution 3.0 Unported License. To view a copy + * of this license, visit + * http://creativecommons.org/licenses/by/3.0/. + * + * Documentation available at: + * http://www.primebox.co.uk/projects/cookie-bar/ + * + * When using this software you use it at your own risk. We hold + * no responsibility for any damage caused by using this plugin + * or the documentation provided. + */ +(function($){ + $.cookieBar = function(options,val){ + if(options=='cookies'){ + var doReturn = 'cookies'; + }else if(options=='set'){ + var doReturn = 'set'; + }else{ + var doReturn = false; + } + var defaults = { + message: 'We use cookies to track usage and preferences.', //Message displayed on bar + acceptButton: true, //Set to true to show accept/enable button + acceptText: 'I Understand', //Text on accept/enable button + acceptFunction: function(cookieValue){if(cookieValue!='enabled' && cookieValue!='accepted') window.location = window.location.href;}, //Function to run after accept + declineButton: false, //Set to true to show decline/disable button + declineText: 'Disable Cookies', //Text on decline/disable button + declineFunction: function(cookieValue){if(cookieValue=='enabled' || cookieValue=='accepted') window.location = window.location.href;}, //Function to run after decline + policyButton: true, //Set to true to show Privacy Policy button + policyText: 'Privacy Policy', //Text on Privacy Policy button + policyURL: '/en/info/policy/', //URL of Privacy Policy + autoEnable: true, //Set to true for cookies to be accepted automatically. Banner still shows + acceptOnContinue: false, //Set to true to silently accept cookies when visitor moves to another page + acceptOnScroll: false, //Set to true to silently accept cookies when visitor scrolls X pixels up or down + expireDays: 365, //Number of days for cookieBar cookie to be stored for + renewOnVisit: false, //Renew the cookie upon revisit to website + forceShow: false, //Force cookieBar to show regardless of user cookie preference + effect: 'slide', //Options: slide, fade, hide + element: 'body', //Element to append/prepend cookieBar to. Remember "." for class or "#" for id. + append: false, //Set to true for cookieBar HTML to be placed at base of website. Actual position may change according to CSS + fixed: true, //Set to true to add the class "fixed" to the cookie bar. Default CSS should fix the position + bottom: true, //Force CSS when fixed, so bar appears at bottom of website + zindex: '10', //Can be set in CSS, although some may prefer to set here + domain: String(window.location.hostname), //Location of privacy policy + referrer: String(document.referrer) //Where visitor has come from + }; + var options = $.extend(defaults,options); + + //Sets expiration date for cookie + var expireDate = new Date(); + expireDate.setTime(expireDate.getTime()+(options.expireDays*86400000)); + expireDate = expireDate.toGMTString(); + + var cookieEntry = 'cb-enabled={value}; expires='+expireDate+'; path=/'; + + //Retrieves current cookie preference + var i,cookieValue='',aCookie,aCookies=document.cookie.split('; '); + for (i=0;i=0 && String(window.location.href).indexOf(options.policyURL)==-1 && doReturn!='cookies' && doReturn!='set' && cookieValue!='accepted' && cookieValue!='declined'){ + doReturn = 'set'; + val = 'accepted'; + } + } + if(doReturn=='cookies'){ + //Returns true if cookies are enabled, false otherwise + if(cookieValue=='enabled' || cookieValue=='accepted'){ + return true; + }else{ + return false; + } + }else if(doReturn=='set' && (val=='accepted' || val=='declined')){ + //Sets value of cookie to 'accepted' or 'declined' + document.cookie = cookieEntry.replace('{value}',val); + if(val=='accepted'){ + return true; + }else{ + return false; + } + }else{ + //Sets up enable/accept button if required + var message = options.message.replace('{policy_url}',options.policyURL); + + if(options.acceptButton){ + var acceptButton = ''+options.acceptText+''; + }else{ + var acceptButton = ''; + } + //Sets up disable/decline button if required + if(options.declineButton){ + var declineButton = ''+options.declineText+''; + }else{ + var declineButton = ''; + } + //Sets up privacy policy button if required + if(options.policyButton){ + var policyButton = ''+options.policyText+''; + }else{ + var policyButton = ''; + } + //Whether to add "fixed" class to cookie bar + if(options.fixed){ + if(options.bottom){ + var fixed = ' class="fixed bottom"'; + }else{ + var fixed = ' class="fixed"'; + } + }else{ + var fixed = ''; + } + if(options.zindex!=''){ + var zindex = ' style="z-index:'+options.zindex+';"'; + }else{ + var zindex = ''; + } + + //Displays the cookie bar if arguments met + if(options.forceShow || cookieValue=='enabled' || cookieValue==''){ + if(options.append){ + $(options.element).append(''+message+acceptButton+declineButton+policyButton+''); + }else{ + $(options.element).prepend(''+message+acceptButton+declineButton+policyButton+''); + } + } + + var removeBar = function(func){ + if(options.acceptOnScroll) $(document).off('scroll'); + if(typeof(func)==='function') func(cookieValue); + if(options.effect=='slide'){ + $('#cookie-bar').slideUp(300,function(){$('#cookie-bar').remove();}); + }else if(options.effect=='fade'){ + $('#cookie-bar').fadeOut(300,function(){$('#cookie-bar').remove();}); + }else{ + $('#cookie-bar').hide(0,function(){$('#cookie-bar').remove();}); + } + }; + var cookieAccept = function(){ + document.cookie = cookieEntry.replace('{value}','accepted'); + removeBar(options.acceptFunction); + }; + var cookieDecline = function(){ + var deleteDate = new Date(); + deleteDate.setTime(deleteDate.getTime()-(864000000)); + deleteDate = deleteDate.toGMTString(); + aCookies=document.cookie.split('; '); + for (i=0;i=0){ + document.cookie = aCookie[0]+'=0; expires='+deleteDate+'; domain='+options.domain.replace('www','')+'; path=/'; + }else{ + document.cookie = aCookie[0]+'=0; expires='+deleteDate+'; path=/'; + } + } + document.cookie = cookieEntry.replace('{value}','declined'); + removeBar(options.declineFunction); + }; + + $('#cookie-bar .cb-enable').click(function(){cookieAccept();return false;}); + $('#cookie-bar .cb-disable').click(function(){cookieDecline();return false;}); + if(options.acceptOnScroll){ + var scrollStart = $(document).scrollTop(),scrollNew,scrollDiff; + $(document).on('scroll',function(){ + scrollNew = $(document).scrollTop(); + if(scrollNew>scrollStart){ + scrollDiff = scrollNew - scrollStart; + }else{ + scrollDiff = scrollStart - scrollNew; + } + if(scrollDiff>=Math.round(options.acceptOnScroll)) cookieAccept(); + }); + } + } + }; +})(jQuery); \ No newline at end of file diff --git a/styles/jquery.cookiebar.css b/styles/jquery.cookiebar.css new file mode 100644 index 0000000..15d3249 --- /dev/null +++ b/styles/jquery.cookiebar.css @@ -0,0 +1,11 @@ +#cookie-bar {background:#111111; height:auto; line-height:24px; color:#eeeeee; text-align:center; padding:3px 0;} +#cookie-bar.fixed {position:fixed; top:0; left:0; width:100%;} +#cookie-bar.fixed.bottom {bottom:0; top:auto;} +#cookie-bar p {margin:0; padding:0;} +#cookie-bar a {color:#ffffff; display:inline-block; border-radius:3px; text-decoration:none; padding:0 6px; margin-left:8px;} +#cookie-bar .cb-enable {background:#007700;} +#cookie-bar .cb-enable:hover {background:#009900;} +#cookie-bar .cb-disable {background:#990000;} +#cookie-bar .cb-disable:hover {background:#bb0000;} +#cookie-bar .cb-policy {background:#0033bb;} +#cookie-bar .cb-policy:hover {background:#0055dd;} \ No newline at end of file
'+message+acceptButton+declineButton+policyButton+'