options['force_lang'] ) ? wp_parse_url( PLL()->links_model->home, PHP_URL_HOST ) : COOKIE_DOMAIN; $samesite = ( 3 === PLL()->options['force_lang'] ) ? 'None' : 'Lax'; $js = sprintf( '(function() { var expirationDate = new Date(); expirationDate.setTime( expirationDate.getTime() + %d * 1000 ); document.cookie = "%s=%s; expires=" + expirationDate.toUTCString() + "; path=%s%s%s%s"; }());', esc_js( apply_filters( 'pll_cookie_expiration', YEAR_IN_SECONDS ) ), esc_js( PLL_COOKIE ), esc_js( pll_current_language() ), esc_js( COOKIEPATH ), $domain ? '; domain=' . esc_js( $domain ) : '', is_ssl() ? '; secure' : '', '; SameSite=' . $samesite ); echo ''; // phpcs:ignore WordPress.Security.EscapeOutput } /** * Informs cache plugins not to cache the home in the default language * When the detection of the browser preferred language is active * * @since 2.3 */ public function do_not_cache_site_home() { if ( ! defined( 'DONOTCACHEPAGE' ) && PLL()->options['browser'] && PLL()->options['hide_default'] && is_front_page() && pll_current_language() === pll_default_language() ) { define( 'DONOTCACHEPAGE', true ); } } }