Code Duplication    Length = 3-9 lines in 5 locations

modules/sso.php 4 locations

@@ 447-450 (lines=4) @@
444
			// If we have something to redirect to
445
			$url = esc_url_raw( $_GET['redirect_to'] );
446
			setcookie( 'jetpack_sso_redirect_to', $url, time() + HOUR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN, false, true );
447
		} elseif ( ! empty( $_COOKIE['jetpack_sso_redirect_to'] ) ) {
448
			// Otherwise, if it's already set, purge it.
449
			setcookie( 'jetpack_sso_redirect_to', ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN );
450
		}
451
	}
452
453
	/**
@@ 564-572 (lines=9) @@
561
	 */
562
	static function clear_cookies_after_login() {
563
		self::clear_wpcom_profile_cookies();
564
		if ( isset( $_COOKIE[ 'jetpack_sso_nonce' ] ) ) {
565
			setcookie(
566
				'jetpack_sso_nonce',
567
				' ',
568
				time() - YEAR_IN_SECONDS,
569
				COOKIEPATH,
570
				COOKIE_DOMAIN
571
			);
572
		}
573
574
		if ( isset( $_COOKIE[ 'jetpack_sso_original_request' ] ) ) {
575
			setcookie(
@@ 574-582 (lines=9) @@
571
			);
572
		}
573
574
		if ( isset( $_COOKIE[ 'jetpack_sso_original_request' ] ) ) {
575
			setcookie(
576
				'jetpack_sso_original_request',
577
				' ',
578
				time() - YEAR_IN_SECONDS,
579
				COOKIEPATH,
580
				COOKIE_DOMAIN
581
			);
582
		}
583
584
		if ( isset( $_COOKIE[ 'jetpack_sso_redirect_to' ] ) ) {
585
			setcookie(
@@ 584-592 (lines=9) @@
581
			);
582
		}
583
584
		if ( isset( $_COOKIE[ 'jetpack_sso_redirect_to' ] ) ) {
585
			setcookie(
586
				'jetpack_sso_redirect_to',
587
				' ',
588
				time() - YEAR_IN_SECONDS,
589
				COOKIEPATH,
590
				COOKIE_DOMAIN
591
			);
592
		}
593
	}
594
595
	static function delete_connection_for_user( $user_id ) {

modules/perf/class.jetpack-perf-optimize-assets.php 1 location

@@ 152-154 (lines=3) @@
149
150
	// by default we only inline scripts+styles on first page load for a given user
151
	function set_first_load_cookie() {
152
		if ( ! isset( $_COOKIE['jetpack_perf_loaded'] ) ) {
153
			setcookie( 'jetpack_perf_loaded', '1', time() + YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN );
154
		}
155
	}
156
157
	// this code essentially sets the default asset location to the footer rather than the head