PluginProbe
Polylang / 2.8
Polylang v2.8
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
← All changes | integrations/cache/cache-compat.php +6 -14 3.02.8 View file →
@@ -26,28 +26,21 @@
26 26 }
27 27 }
28 28
29 29 /**
30 - * Currently all tested cache plugins don't send cookies with cached pages.
31 - * This makes us impossible to know the language of the last browsed page.
32 - * This functions allows to create the cookie in javascript as a workaround.
30 + * Currently all tested cache plugins don't send cookies with cached pages
31 + * This makes us impossible know the language of the last browsed page
32 + * This functions allows to create the cookie in javascript as a workaround
33 33 *
34 34 * @since 2.3
35 35 */
36 36 public function add_cookie_script() {
37 - // Embeds should not set the cookie.
38 - if ( is_embed() ) {
39 - return;
40 - }
41 -
42 - $domain = ( 2 === PLL()->options['force_lang'] ) ? wp_parse_url( PLL()->links_model->home, PHP_URL_HOST ) : COOKIE_DOMAIN;
43 - $samesite = ( 3 === PLL()->options['force_lang'] ) ? 'None' : 'Lax';
44 -
37 + $domain = ( 2 == PLL()->options['force_lang'] ) ? wp_parse_url( PLL()->links_model->home, PHP_URL_HOST ) : COOKIE_DOMAIN;
45 38 $js = sprintf(
46 39 '(function() {
47 40 var expirationDate = new Date();
48 41 expirationDate.setTime( expirationDate.getTime() + %d * 1000 );
49 - document.cookie = "%s=%s; expires=" + expirationDate.toUTCString() + "; path=%s%s%s%s";
42 + document.cookie = "%s=%s; expires=" + expirationDate.toUTCString() + "; path=%s%s%s";
50 43 }());',
51 44 esc_js( apply_filters( 'pll_cookie_expiration', YEAR_IN_SECONDS ) ),
52 45 esc_js( PLL_COOKIE ),
53 46 esc_js( pll_current_language() ),
@@ -52,10 +45,9 @@
52 45 esc_js( PLL_COOKIE ),
53 46 esc_js( pll_current_language() ),
54 47 esc_js( COOKIEPATH ),
55 48 $domain ? '; domain=' . esc_js( $domain ) : '',
56 - is_ssl() ? '; secure' : '',
57 - '; SameSite=' . $samesite
49 + is_ssl() ? '; secure' : ''
58 50 );
59 51 echo '<script type="text/javascript">' . $js . '</script>'; // phpcs:ignore WordPress.Security.EscapeOutput
60 52 }
61 53