Code Duplication    Length = 11-12 lines in 2 locations

extensions/blocks/premium-content/_inc/access-check.php 1 location

@@ 36-46 (lines=11) @@
33
 *
34
 * @return bool
35
 */
36
function required_plan_checks() {
37
	// For WPCOM sites.
38
	if ( defined( 'IS_WPCOM' ) && IS_WPCOM && function_exists( 'has_any_blog_stickers' ) ) {
39
		$site_id = get_current_blog_id();
40
		return has_any_blog_stickers( array( 'personal-plan', 'premium-plan', 'business-plan', 'ecommerce-plan' ), $site_id );
41
	}
42
43
	// For Jetpack sites, only Atomic sites (with a business plan
44
	// or above) have the block, so no upgrade is required.
45
	return true;
46
}
47
48
/**
49
 * Determines if the block should be rendered. Returns true

modules/memberships/class-jetpack-memberships.php 1 location

@@ 448-459 (lines=12) @@
445
	/**
446
	 * Whether the site's plan supports the Recurring Payments block.
447
	 */
448
	public static function is_supported_jetpack_recurring_payments() {
449
		// For WPCOM sites.
450
		if ( defined( 'IS_WPCOM' ) && IS_WPCOM && function_exists( 'has_any_blog_stickers' ) ) {
451
			$site_id = get_current_blog_id();
452
			return has_any_blog_stickers( array( 'personal-plan', 'premium-plan', 'business-plan', 'ecommerce-plan' ), $site_id );
453
		}
454
		// For Jetpack sites.
455
		return (
456
			Jetpack::is_active() &&
457
			Jetpack_Plan::supports( 'recurring-payments' )
458
		);
459
	}
460
461
	/**
462
	 * Register the Recurring Payments Gutenberg block