From 8be807ee80aa50ea8ef992f1d5e6feb7b5275f8b Mon Sep 17 00:00:00 2001 From: Jose Castaneda Date: Tue, 14 Jan 2020 19:46:26 -0800 Subject: [PATCH] Adds filter for the cookie name This adds a filter for the cookie name so a plugin or even a theme could effectively change it without having to modify code to the plugin which could be reverted back on updates. A quick example could be used in plugin or perhaps a theme's functions file: ``` add_filter( 'cn_cookie_name', function($string) { return 'super_sweet_chocolate_cookie'; }, 10 ); ``` --- cookie-notice.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cookie-notice.php b/cookie-notice.php index b19198b..3715437 100644 --- a/cookie-notice.php +++ b/cookie-notice.php @@ -1395,7 +1395,7 @@ public function wp_enqueue_scripts() { 'onScroll' => $this->options['general']['on_scroll'], 'onScrollOffset' => $this->options['general']['on_scroll_offset'], 'onClick' => $this->options['general']['on_click'], - 'cookieName' => 'cookie_notice_accepted', + 'cookieName' => apply_filters( 'cn_cookie_name', 'cookie_notice_accepted' ), 'cookieValue' => 'true', 'cookieTime' => $this->times[$this->options['general']['time']][1], 'cookiePath' => ( defined( 'COOKIEPATH' ) ? (string) COOKIEPATH : '' ), @@ -1456,4 +1456,4 @@ function Cookie_Notice() { return $instance; } -$cookie_notice = Cookie_Notice(); \ No newline at end of file +$cookie_notice = Cookie_Notice();