* @copyright: 2020 - Foursites * * Created: 2020-03-18, 11:10:34 am * Modified: 2020-03-18, 11:10:47 am * Modified By: Jorre Spijker */ namespace FSWP; if ( ! defined( 'ABSPATH' ) ) { die(); } class GDPR { public static function allowCookies() { $value = isset( $_GET['allow'] ) && $_GET['allow'] ? 'true' : 'false'; $referer = isset( $_GET['referer'] ) ? $_GET['referer'] : \wp_get_referer(); self::setCookieSettings( $value, $referer ); exit; } public static function changeCookieSettings() { $value = isset( $_POST['cookie_setting'] ) && 'true' === $_POST['cookie_setting'] ? 'true' : 'false'; $referer = isset( $_POST['referer'] ) ? $_POST['referer'] : \wp_get_referer(); self::setCookieSettings( $value, $referer ); exit; } public static function setCookieSettings( $value = 'true', $referer = '' ) { $referer = $referer ?: \get_home_url(); $expiration = time() + 60 * 60 * 24 * 365; \setcookie( 'allow_all_cookies', $value, $expiration, COOKIEPATH, COOKIE_DOMAIN ); \wp_safe_redirect($referer); exit; } } 0