Untitled

 avatar
unknown
plain_text
4 years ago
910 B
7
Indexable
class BWF_Funnel_Temp_15032021 {
	public function __construct() {
		add_filter( 'wfocu_front_ecomm_tracking', [ $this, 'wffn_borlabs_cookie_check' ] );
		add_filter( 'wfacp_do_tracking', [ $this, 'wffn_borlabs_cookie_check' ] );
		add_filter( 'wfacp_css_js_deque', [ $this, 'wfacp_allow_boorlabs_cookie' ], 10, 3 );
	}

	function wffn_borlabs_cookie_check( $should_render ) {
		$should_render = false;
		if ( isset( $_COOKIE['cookieSet'] ) && !empty( $_COOKIE['cookieSet'] ) ) {
			$cookie_data = json_decode( stripslashes( wc_clean( $_COOKIE['cookieSet'] ) ), ARRAY_A );
			if (count(array_flip($cookie_data)) === 1 && end($cookie_data) === 'set') {
				$should_render = true;
			}
		}

		return $should_render;
	}

	function wfacp_allow_boorlabs_cookie( $status, $path, $url ) {
		if ( false !== strpos( $url, 'cookieSet' ) ) {
			$status = false;
		}

		return $status;
	}

}
new BWF_Funnel_Temp_15032021();
Editor is loading...