can_use_premium_code(); } /** * Number of sites the license covers: null for unlimited, 0 without a license. * The local development switch counts as an agency license. */ public static function license_sites(): ?int { if ( defined( 'STRIKEWISE_DEV_PREMIUM' ) && STRIKEWISE_DEV_PREMIUM && 'local' === wp_get_environment_type() ) { return 25; } if ( ! self::is_configured() || ! method_exists( strikewise_fs(), '_get_license' ) ) { return 0; } $license = strikewise_fs()->_get_license(); if ( ! is_object( $license ) ) { return 0; } return isset( $license->quota ) && null !== $license->quota ? (int) $license->quota : null; } /** * The agency cockpit needs a license for at least 5 shops (Business or Agency). * During the trial there is no license yet, so agencies can try it out. */ public static function cockpit_allowed(): bool { if ( ! self::can_use_premium() ) { return false; } if ( strikewise_fs()->is_trial() ) { return true; } $sites = self::license_sites(); return null === $sites || $sites >= 5; } /** * Whether to show upgrade hints: Freemius is set up and the shop has no license. */ public static function show_upsell(): bool { $show = self::is_configured() && ! self::can_use_premium() && strikewise_fs()->is_not_paying(); /** * Filters whether Strikewise shows upgrade hints (banner, dashboard widget, settings). * * @param bool $show */ return (bool) apply_filters( 'strikewise_show_upsell', $show ); } public static function upgrade_url(): string { return self::is_configured() ? (string) strikewise_fs()->get_upgrade_url() : ''; } public static function trial_url(): string { return self::is_configured() ? (string) strikewise_fs()->get_trial_url() : ''; } }