if(isset($_COOKIE['wpl_viewed_cookie'])) {
switch($_COOKIE['wpl_viewed_cookie']) {
// the user has accepted one or more type of cookies.
$valid_php_json = preg_replace('/\s*:\s*([a-zA-Z0-9_]+?)([}\[,])/', ':"$1"$2', preg_replace('/([{\[,])\s*([a-zA-Z0-9_]+?):/', '$1"$2":', str_replace("'", '"',stripslashes($_COOKIE['wpl_user_preference']))));
$wpl_user_preference = json_decode($valid_php_json);
if($wpl_user_preference->analytics === 'yes') {
// user has accepted analytics cookies.
// user has not accepted analytics cookies.
if($wpl_user_preference->marketing === 'yes') {
// user has accepted marketing cookies.
// user has not accepted marketing cookies.
if($wpl_user_preference->preferences === 'yes') {
// user has accepted preferences cookies.
// user has not accepted preferences cookies.
// the user has not accepted cookies - set necessary cookies only.
// the user has not accepted cookies - set necessary cookies only.