From 4554bd26a22e8382db0a0cabc291d5f7a1348b11 Mon Sep 17 00:00:00 2001 From: Jay Wood Date: Sun, 9 Nov 2014 23:15:53 -0500 Subject: [PATCH] Add cookiename to js params --- class/main.class.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/class/main.class.php b/class/main.class.php index c76fa21..75abdd4 100644 --- a/class/main.class.php +++ b/class/main.class.php @@ -52,6 +52,7 @@ class CWV3 { 'id' => $p_ID, 'opacity' => get_option( 'cwv3_bg_opacity', 0.85 ), 'cookie_path' => SITECOOKIEPATH, + 'cookie_name' => $this->get_cookie_name(), ) ); } @@ -70,6 +71,23 @@ class CWV3 { wp_register_style( 'cwv3_css', plugins_url( "css/cwv3{$min}.css", dirname( __FILE__ ) ), array( 'colorbox' ), '1.0' ); } + public function get_cookie_name(){ + + $sitewide = get_option( 'cwv3_sitewide' ); + $homepage = get_option( 'cwv3_homepage' ); + $misc = get_option( 'cwv3_misc' ); + + if( 'enabled' == ! empty( $sitewide ) ){ + return 'sitewide'; + } + + if( 'enabled' == ! empty( $homepage ) && is_front_page() ){ + return 'homepage'; + } + + return false; + } + public function set_cookie( $id, $action ) { $time = get_option( 'cwv3_death' );