Changeset 1127609
- Timestamp:
- 04/04/2015 09:00:17 AM (11 years ago)
- Location:
- easy-cookie-law/trunk
- Files:
-
- 2 edited
-
easy-cookie-law.php (modified) (3 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
easy-cookie-law/trunk/easy-cookie-law.php
r1117527 r1127609 3 3 * Plugin Name: Easy Cookie Law 4 4 * Description: Minimal code to make sure your website repect the coockie law 5 * Version: 0.1. 15 * Version: 0.1.2 6 6 * Author: Antonio Sanchez 7 7 * Author URI: http://antsanchez.com … … 208 208 /** 209 209 * 210 * Function to check if the visitor is a Bot 211 * 212 */ 213 function ecl_crawler_detect($USER_AGENT){ 214 $bots_list = array( 215 'Google'=> 'Googlebot', 216 'Bing' => 'bingbot', 217 'Rambler'=>'Rambler', 218 'Yahoo'=> 'Slurp', 219 'AbachoBOT'=> 'AbachoBOT', 220 'accoona'=> 'Accoona', 221 'AcoiRobot'=> 'AcoiRobot', 222 'ASPSeek'=> 'ASPSeek', 223 'CrocCrawler'=> 'CrocCrawler', 224 'Dumbot'=> 'Dumbot', 225 'FAST-WebCrawler'=> 'FAST-WebCrawler', 226 'GeonaBot'=> 'GeonaBot', 227 'Gigabot'=> 'Gigabot', 228 'Lycos spider'=> 'Lycos', 229 'MSRBOT'=> 'MSRBOT', 230 'Altavista robot'=> 'Scooter', 231 'AltaVista robot'=> 'Altavista', 232 'ID-Search Bot'=> 'IDBot', 233 'eStyle Bot'=> 'eStyle', 234 'Scrubby robot'=> 'Scrubby', 235 ); 236 237 $regexp= '/'. implode("|", $bots_list).'/'; 238 if ( preg_match($regexp, $USER_AGENT)){ 239 return true; 240 // It is a bot 241 }else{ 242 return false; 243 // It is not 244 } 245 } 246 247 /** 248 * 210 249 * Creates cookie 211 250 * … … 213 252 function ecl_cookie_test(){ 214 253 215 $name = "easy-cookie-law"; 216 session_start(); 217 global $ecl_user; 218 if(isset($_COOKIE[$name])){ 219 $ecl_user = $_COOKIE[$name]; 220 if($ecl_user == 1){ 221 setcookie($name, 3, time() + (86400 * 30), "/"); 222 $ecl_user = 3; 254 if(!ecl_crawler_detect($_SERVER['HTTP_USER_AGENT'])){ 255 $name = "easy-cookie-law"; 256 session_start(); 257 global $ecl_user; 258 if(isset($_COOKIE[$name])){ 259 $ecl_user = $_COOKIE[$name]; 260 if($ecl_user == 1){ 261 setcookie($name, 3, time() + (86400 * 30), "/"); 262 $ecl_user = 3; 263 } 264 }else{ 265 setcookie($name, 1, time() + (86400 * 30)); 266 $ecl_user = 1; 223 267 } 224 }else{225 setcookie($name, 1, time() + (86400 * 30));226 $ecl_user = 1;227 268 } 228 269 } -
easy-cookie-law/trunk/readme.txt
r1117527 r1127609 4 4 Requires at least: 3.0.1 5 5 Tested up to: 4.1.1 6 Stable tag: 0.1. 16 Stable tag: 0.1.2 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 15 15 Easy Cookie Law allows you to easily comply with the european cookie law, showing 16 16 a notice to the user only the very first time that visits your website. 17 Message, position and the style can be eas ily modified through the plugin menu.17 Message, position and the style can be easyly modified through the plugin menu. 18 18 19 19 It helps you with SEO, since the plugin will not add any CSS stylesheet or Javascript file, … … 38 38 will not be shown again. 39 39 40 If the visitor is a bot, like Google or Bing, the message won't be shown. 41 40 42 = Why am I not seeing the message? = 41 43
Note: See TracChangeset
for help on using the changeset viewer.