Changeset 872141
- Timestamp:
- 03/09/2014 11:14:56 AM (12 years ago)
- Location:
- cartograf-cookie-filter/trunk
- Files:
-
- 5 edited
-
cartograf-cookie-filter.php (modified) (3 diffs)
-
functions.php (modified) (4 diffs)
-
readme.txt (modified) (3 diffs)
-
script.js (modified) (3 diffs)
-
style.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cartograf-cookie-filter/trunk/cartograf-cookie-filter.php
r846932 r872141 4 4 Plugin URI: http://www.cartograf.net/plugin-wordpress-cumplir-ley-de-cookies-espana 5 5 Description: Previene la instalación de cookies previa al consentimiento informado de los visitantes 6 Version: 1. 0.77 Author: Jose Alcántara & Dima Kam /Cartograf6 Version: 1.1.0 7 Author: Cartograf 8 8 Author URI: http://www.cartograf.net 9 9 Author Email: info@cartograf.net … … 14 14 require_once('functions.php'); 15 15 require_once('settings_page.php'); 16 17 16 18 17 register_activation_hook( __FILE__, 'cg_cf_activate' ); … … 40 39 add_filter("plugin_action_links_{$plugin}", 'cg_cf_settings_link' ); 41 40 42 function cg_cf_head(){ 43 if (cg_cf_cookie_accepted()){ 44 cg_cf_head_accepted(); 45 }else{ 46 cg_cf_head_denied(); 47 } 48 } 41 // TODO: remove this hook because it is no longer needed. 42 function cg_cf_head(){} 49 43 add_action('wp_head','cg_cf_head',999999+2); 50 44 51 45 function cg_cf_foot(){ 52 if (cg_cf_cookie_accepted()){ 53 cg_cf_foot_accepted(); 54 }else{ 55 cg_cf_foot_denied(); 56 cg_cf_cookie_bar(); 57 cg_cf_code_templates(); 58 } 46 cg_cf_cookie_bar(); 47 cg_cf_code_templates(); 59 48 } 60 49 add_action('wp_footer','cg_cf_foot',999999+2); 61 50 62 51 function cg_cf_enqueue_script() { 63 if (!cg_cf_cookie_accepted()){ 64 wp_enqueue_script( 'jquery' ); 65 wp_enqueue_script( 'cg_cookie-filter', plugins_url('cartograf-cookie-filter').'/script.js',array('jquery') ); 66 } 67 52 wp_enqueue_script( 'jquery' ); 53 wp_enqueue_script( 'cg_cookie-filter', plugins_url('cartograf-cookie-filter').'/script.js',array('jquery') ); 68 54 } 69 55 -
cartograf-cookie-filter/trunk/functions.php
r837080 r872141 1 1 <?php 2 function cg_cf_cookie_accepted(){3 return !empty($_COOKIE['cg_cookie_accepted']);4 }5 6 2 function cg_cf_cookie_bar(){ 7 3 $text = get_option('cg_cf_text'); … … 23 19 ); 24 20 25 echo '<script type="text/template" id="cg_cf_head_template ">/*!* ';21 echo '<script type="text/template" id="cg_cf_head_template_accepted">/*!* '; 26 22 echo str_replace($replace['from'],$replace['to'],cg_cf_get_head_accepted()); 27 23 echo ' *!*/</script>'; 28 echo '<script type="text/template" id="cg_cf_foot_template">/*!* '; 24 echo '<script type="text/template" id="cg_cf_head_template_denied">/*!* '; 25 echo str_replace($replace['from'],$replace['to'],cg_cf_get_head_denied()); 26 echo ' *!*/</script>'; 27 echo '<script type="text/template" id="cg_cf_foot_template_accepted">/*!* '; 29 28 echo str_replace($replace['from'],$replace['to'],cg_cf_get_foot_accepted()); 29 echo ' *!*/</script>'; 30 echo '<script type="text/template" id="cg_cf_foot_template_denied">/*!* '; 31 echo str_replace($replace['from'],$replace['to'],cg_cf_get_foot_denied()); 30 32 echo ' *!*/</script>'; 31 33 } … … 36 38 } 37 39 38 function cg_cf_head_accepted(){39 echo cg_cf_get_head_accepted();40 }41 42 40 function cg_cf_get_head_denied(){ 43 41 $code = get_option('cg_cf_head_denied_code'); 44 42 return $code; 45 }46 47 function cg_cf_head_denied(){48 echo cg_cf_get_head_denied();49 43 } 50 44 … … 54 48 } 55 49 56 function cg_cf_foot_accepted(){57 echo cg_cf_get_foot_accepted();58 }59 60 50 function cg_cf_get_foot_denied(){ 61 51 $code = get_option('cg_cf_foot_denied_code'); 62 52 return $code; 63 }64 65 function cg_cf_foot_denied(){66 echo cg_cf_get_foot_denied();67 53 } 68 54 -
cartograf-cookie-filter/trunk/readme.txt
r846932 r872141 6 6 Requires at least: 3.6 7 7 Tested up to: 3.8.1 8 Stable tag: 1. 0.78 Stable tag: 1.1.0 9 9 License: GPLv3 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 55 55 == Changelog == 56 56 57 = 1.1.0 = 58 * Cookie checking is now implemented client-side, to make the plugin compatible with cache plugins. Thanks to Sergio Folgar (/sfolgar) for this contribution. 59 57 60 = 1.0.7 = 58 61 * Added info about compatibility with cache plugins … … 81 84 * Overwrite previous version of the plugin. 82 85 86 == Contributors == 87 88 * Jose Alcántara 89 * Dima Kam 90 * Sergio Folgar 91 83 92 84 93 == About Cartograf == -
cartograf-cookie-filter/trunk/script.js
r837080 r872141 25 25 }); 26 26 } 27 27 28 insertTemplatesDenied(); 29 } else { 30 cookies_accepted(); 28 31 } 29 32 }); … … 35 38 hide_cookie_bar(); 36 39 jQuery('a').unbind('click',cookies_accepted); 37 insertTemplates ();40 insertTemplatesAccepted(); 38 41 } 39 42 } … … 67 70 function needToCheckCookie(){ 68 71 var userDate = new Date(); 69 timezone = -(userDate.getTimezoneOffset()/60); 72 var timezone = -(userDate.getTimezoneOffset()/60); 73 var cookie_preset = document.cookie.indexOf('cg_cookie_accepted=1') >= 0; 70 74 71 var result = timezone>=0 && timezone<=3 ;75 var result = timezone>=0 && timezone<=3 && !cookie_preset; 72 76 73 77 return result; 74 78 } 75 79 76 function insertTemplates(){ 80 function insertTemplatesAccepted(){ 81 insertTemplates('accepted'); 82 } 83 84 function insertTemplatesDenied(){ 85 insertTemplates('denied'); 86 } 87 88 function insertTemplates(sufix){ 77 89 var templates = [ 78 'cg_cf_head_template ',79 'cg_cf_foot_template '90 'cg_cf_head_template_' + sufix, 91 'cg_cf_foot_template_' + sufix 80 92 ]; 81 93 for(var i=0; i < templates.length; i++){ -
cartograf-cookie-filter/trunk/style.css
r837080 r872141 1 1 #cg_cookie_bar { 2 display: none; 2 3 position:fixed; 3 4 top:0px;
Note: See TracChangeset
for help on using the changeset viewer.