Changeset 3056649 for jetpack/trunk/extensions/blocks/premium-content/_inc/subscription-service/class-abstract-token-subscription-service.php
- Timestamp:
- 03/22/2024 09:30:19 AM (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
jetpack/trunk/extensions/blocks/premium-content/_inc/subscription-service/class-abstract-token-subscription-service.php
r3049965 r3056649 29 29 const POST_ACCESS_LEVEL_PAID_SUBSCRIBERS = 'paid_subscribers'; 30 30 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|null36 */37 protected $user_id = null;38 39 /**40 * Constructor41 *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 }47 31 48 32 /** … … 461 445 462 446 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. 465 448 } 466 449 } … … 469 452 * Clear the auth cookie. 470 453 * 471 * @param string $cookie_domain Domain to remove cookie from.472 *473 454 * @return void 474 455 */ 475 public static function clear_token_cookie( $cookie_domain = '') {456 public static function clear_token_cookie() { 476 457 if ( defined( 'TESTING_IN_JETPACK' ) && TESTING_IN_JETPACK ) { 477 458 return; … … 480 461 if ( self::has_token_from_cookie() ) { 481 462 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 ); 487 464 } 488 465 }
Note: See TracChangeset
for help on using the changeset viewer.