Plugin Directory

Timestamp:
03/22/2024 09:30:19 AM (4 months ago)
Author:
zinigor
Message:

Updating trunk to version 13.2.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • jetpack/trunk/extensions/blocks/premium-content/_inc/subscription-service/class-abstract-token-subscription-service.php

    r3049965 r3056649  
    2929    const POST_ACCESS_LEVEL_PAID_SUBSCRIBERS           = 'paid_subscribers';
    3030    const POST_ACCESS_LEVEL_PAID_SUBSCRIBERS_ALL_TIERS = 'paid_subscribers_all_tiers';
    31 
    32     /**
    33      * An optional user_id to query against (omitting this will use either the token or current user id)
    34      *
    35      * @var int|null
    36      */
    37     protected $user_id = null;
    38 
    39     /**
    40      * Constructor
    41      *
    42      * @param int|null $user_id An optional user_id to query subscriptions against. Uses token from request/cookie or logged-in user information if omitted.
    43      */
    44     public function __construct( $user_id = null ) {
    45         $this->user_id = $user_id;
    46     }
    4731
    4832    /**
     
    461445
    462446        if ( ! empty( $token ) && false === headers_sent() ) {
    463             // phpcs:ignore Jetpack.Functions.SetCookie.FoundNonHTTPOnlyFalse
    464             setcookie( self::JWT_AUTH_TOKEN_COOKIE_NAME, $token, strtotime( '+1 month' ), '/', COOKIE_DOMAIN, is_ssl(), false );
     447            setcookie( self::JWT_AUTH_TOKEN_COOKIE_NAME, $token, 0, '/', COOKIE_DOMAIN, is_ssl(), true ); // httponly -- used by visitor_can_view_content() within the PHP context.
    465448        }
    466449    }
     
    469452     * Clear the auth cookie.
    470453     *
    471      * @param string $cookie_domain Domain to remove cookie from.
    472      *
    473454     * @return void
    474455     */
    475     public static function clear_token_cookie( $cookie_domain = '' ) {
     456    public static function clear_token_cookie() {
    476457        if ( defined( 'TESTING_IN_JETPACK' ) && TESTING_IN_JETPACK ) {
    477458            return;
     
    480461        if ( self::has_token_from_cookie() ) {
    481462            unset( $_COOKIE[ self::JWT_AUTH_TOKEN_COOKIE_NAME ] );
    482             setcookie( self::JWT_AUTH_TOKEN_COOKIE_NAME, '', 1, '/', COOKIE_DOMAIN, is_ssl(), true );
    483 
    484             if ( ! empty( $cookie_domain ) ) {
    485                 setcookie( self::JWT_AUTH_TOKEN_COOKIE_NAME, '', 1, '/', $cookie_domain, is_ssl(), true );
    486             }
     463            setcookie( self::JWT_AUTH_TOKEN_COOKIE_NAME, '', time() - DAY_IN_SECONDS, '/', COOKIE_DOMAIN, is_ssl(), true );
    487464        }
    488465    }
Note: See TracChangeset for help on using the changeset viewer.