Polylang - Version 3.1.1

Version Description

(2021-08-16) =

  • Pro: Fix a fatal error with The Events Calendar
  • Allow to remove the cookie with the pll_cookie_expiration filter #905
Download this release

Release Info

Developer Chouby
Plugin Icon 128x128 Polylang
Version 3.1.1
Comparing to
See all releases

Code changes from version 3.1 to 3.1.1

include/cookie.php CHANGED
@@ -22,16 +22,17 @@ class PLL_Cookie {
22
  * Filters the Polylang cookie duration.
23
  *
24
  * If a cookie duration of 0 is specified, a session cookie will be set.
 
25
  * /!\ This filter may be fired *before* the theme is loaded.
26
  *
27
  * @since 1.8
28
  *
29
  * @param int $duration Cookie duration in seconds.
30
  */
31
- $expiration = apply_filters( 'pll_cookie_expiration', YEAR_IN_SECONDS );
32
 
33
  $defaults = array(
34
- 'expires' => $expiration > 0 ? time() + $expiration : 0,
35
  'path' => COOKIEPATH,
36
  'domain' => COOKIE_DOMAIN, // Cookie domain must be set to false for localhost ( default value for COOKIE_DOMAIN ) thanks to Stephen Harris.
37
  'secure' => is_ssl(),
22
  * Filters the Polylang cookie duration.
23
  *
24
  * If a cookie duration of 0 is specified, a session cookie will be set.
25
+ * If a negative cookie duration is specified, the cookie is removed.
26
  * /!\ This filter may be fired *before* the theme is loaded.
27
  *
28
  * @since 1.8
29
  *
30
  * @param int $duration Cookie duration in seconds.
31
  */
32
+ $expiration = (int) apply_filters( 'pll_cookie_expiration', YEAR_IN_SECONDS );
33
 
34
  $defaults = array(
35
+ 'expires' => 0 !== $expiration ? time() + $expiration : 0,
36
  'path' => COOKIEPATH,
37
  'domain' => COOKIE_DOMAIN, // Cookie domain must be set to false for localhost ( default value for COOKIE_DOMAIN ) thanks to Stephen Harris.
38
  'secure' => is_ssl(),
integrations/cache/cache-compat.php CHANGED
@@ -45,9 +45,9 @@ class PLL_Cache_Compat {
45
  $samesite = ( 3 === PLL()->options['force_lang'] ) ? 'None' : 'Lax';
46
 
47
  /** This filter is documented in include/cookie.php */
48
- $expiration = apply_filters( 'pll_cookie_expiration', YEAR_IN_SECONDS );
49
 
50
- if ( $expiration > 0 ) {
51
  $format = 'var expirationDate = new Date();
52
  expirationDate.setTime( expirationDate.getTime() + %7$d * 1000 );
53
  document.cookie = "%1$s=%2$s; expires=" + expirationDate.toUTCString() + "; path=%3$s%4$s%5$s%6$s";';
45
  $samesite = ( 3 === PLL()->options['force_lang'] ) ? 'None' : 'Lax';
46
 
47
  /** This filter is documented in include/cookie.php */
48
+ $expiration = (int) apply_filters( 'pll_cookie_expiration', YEAR_IN_SECONDS );
49
 
50
+ if ( 0 !== $expiration ) {
51
  $format = 'var expirationDate = new Date();
52
  expirationDate.setTime( expirationDate.getTime() + %7$d * 1000 );
53
  document.cookie = "%1$s=%2$s; expires=" + expirationDate.toUTCString() + "; path=%3$s%4$s%5$s%6$s";';
polylang.php CHANGED
@@ -10,7 +10,7 @@
10
  * Plugin Name: Polylang
11
  * Plugin URI: https://polylang.pro
12
  * Description: Adds multilingual capability to WordPress
13
- * Version: 3.1
14
  * Requires at least: 5.4
15
  * Requires PHP: 5.6
16
  * Author: WP SYNTEX
@@ -53,7 +53,7 @@ if ( defined( 'POLYLANG_VERSION' ) ) {
53
  }
54
  } else {
55
  // Go on loading the plugin
56
- define( 'POLYLANG_VERSION', '3.1' );
57
  define( 'PLL_MIN_WP_VERSION', '5.4' );
58
  define( 'PLL_MIN_PHP_VERSION', '5.6' );
59
 
10
  * Plugin Name: Polylang
11
  * Plugin URI: https://polylang.pro
12
  * Description: Adds multilingual capability to WordPress
13
+ * Version: 3.1.1
14
  * Requires at least: 5.4
15
  * Requires PHP: 5.6
16
  * Author: WP SYNTEX
53
  }
54
  } else {
55
  // Go on loading the plugin
56
+ define( 'POLYLANG_VERSION', '3.1.1' );
57
  define( 'PLL_MIN_WP_VERSION', '5.4' );
58
  define( 'PLL_MIN_PHP_VERSION', '5.6' );
59
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: multilingual, bilingual, translate, translation, language, multilanguage,
5
  Requires at least: 5.4
6
  Tested up to: 5.8
7
  Requires PHP: 5.6
8
- Stable tag: 3.1
9
  License: GPLv3 or later
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -78,6 +78,11 @@ Don't hesitate to [give your feedback](http://wordpress.org/support/view/plugin-
78
 
79
  == Changelog ==
80
 
 
 
 
 
 
81
  = 3.1 (2021-07-27) =
82
 
83
  * Add compatibility with WordPress 5.8
5
  Requires at least: 5.4
6
  Tested up to: 5.8
7
  Requires PHP: 5.6
8
+ Stable tag: 3.1.1
9
  License: GPLv3 or later
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
78
 
79
  == Changelog ==
80
 
81
+ = 3.1.1 (2021-08-16) =
82
+
83
+ * Pro: Fix a fatal error with The Events Calendar
84
+ * Allow to remove the cookie with the pll_cookie_expiration filter #905
85
+
86
  = 3.1 (2021-07-27) =
87
 
88
  * Add compatibility with WordPress 5.8