private function check_active_user() {

		if (
			( ! isset( $this->opts['wpengine'] ) || $this->opts['wpengine'] != '1' || getenv( 'HTTP_GEOIP_COUNTRY_CODE' ) === false )
			&& ( ! isset( $this->opts['maxmind'] ) || $this->opts['maxmind'] != '1' || ! file_exists( maxmind_db() ) )
			&& ( ! isset( $this->opts['ip2location'] ) || $this->opts['ip2location'] != '1' || ! file_exists( ip2location_db() ) )
			&& ( ! isset( $this->opts['kinsta'] ) || $this->opts['kinsta'] != '1' || empty( $_SERVER['HTTP_GEOIP_CITY_COUNTRY_NAME'] ) )
		) {
			return true;
		}

		if ( empty( $this->opts['license'] ) ) {
			throw new InvalidLicenseException( json_encode( [ 'error' => 'Missing or invalid license' ] ) );
		}

		if ( false === ( $active_user = get_site_transient( 'geot_active_user' ) ) ) {
			// It wasn't there, so regenerate the data and save the transient
			$active_user = GeotargetingWP::checkSubscription( $this->opts['license'] );
			$result      = json_decode( $active_user );
			if ( ! isset( $result->success ) ) {
				throw new InvalidSubscriptionException( json_encode( [ 'error' => $result->error ] ) );
			}

			set_site_transient( 'geot_active_user', true, DAY_IN_SECONDS );

			return true;
		}

		return $active_user;
	}
private function check_active_user() {

		if (
			( ! isset( $this->opts['wpengine'] ) || $this->opts['wpengine'] != '1' || getenv( 'HTTP_GEOIP_COUNTRY_CODE' ) === false )
			&& ( ! isset( $this->opts['maxmind'] ) || $this->opts['maxmind'] != '1' || ! file_exists( maxmind_db() ) )
			&& ( ! isset( $this->opts['ip2location'] ) || $this->opts['ip2location'] != '1' || ! file_exists( ip2location_db() ) )
			&& ( ! isset( $this->opts['kinsta'] ) || $this->opts['kinsta'] != '1' || empty( $_SERVER['HTTP_GEOIP_CITY_COUNTRY_NAME'] ) )
		) {
			return true;
		}

		if ( empty( $this->opts['license'] ) ) {
			throw new InvalidLicenseException( json_encode( [ 'error' => 'Missing or invalid license' ] ) );
		}

		if ( false === ( $active_user = get_site_transient( 'geot_active_user' ) ) ) {
			// It wasn't there, so regenerate the data and save the transient
			$active_user = GeotargetingWP::checkSubscription( $this->opts['license'] );
			$result      = json_decode( $active_user );
			if ( ! isset( $result->success ) ) {
				throw new InvalidSubscriptionException( json_encode( [ 'error' => $result->error ] ) );
			}

			set_site_transient( 'geot_active_user', true, DAY_IN_SECONDS );

			return true;
		}

		return $active_user;
	}
private function check_active_user ( ) { if ( ( ! isset ( $ this -> opts [ 'wpengine' ] ) || $ this -> opts [ 'wpengine' ] != '1' || getenv ( 'HTTP_GEOIP_COUNTRY_CODE' ) === false ) && ( ! isset ( $ this -> opts [ 'maxmind' ] ) || $ this -> opts [ 'maxmind' ] != '1' || ! file_exists ( maxmind_db ( ) ) ) && ( ! isset ( $ this -> opts [ 'ip2location' ] ) || $ this -> opts [ 'ip2location' ] != '1' || ! file_exists ( ip2location_db ( ) ) ) && ( ! isset ( $ this -> opts [ 'kinsta' ] ) || $ this -> opts [ 'kinsta' ] != '1' || empty ( $ _SERVER [ 'HTTP_GEOIP_CITY_COUNTRY_NAME' ] ) ) ) { return true ; } if ( empty ( $ this -> opts [ 'license' ] ) ) { throw new InvalidLicenseException ( json_encode ( [ 'error' => 'Missing or invalid license' ] ) ) ; } if ( false === ( $ active_user = get_site_transient ( 'geot_active_user' ) ) ) { // It wasn't there, so regenerate the data and save the transient $ active_user = GeotargetingWP :: checkSubscription ( $ this -> opts [ 'license' ] ) ; $ result = json_decode ( $ active_user ) ; if ( ! isset ( $ result -> success ) ) { throw new InvalidSubscriptionException ( json_encode ( [ 'error' => $ result -> error ] ) ) ; } set_site_transient ( 'geot_active_user' , true , DAY_IN_SECONDS ) ; return true ; } return $ active_user ; }
Check if user has active subscription
@return bool
@throws InvalidLicenseException
@throws InvalidSubscriptionException
Check if user has active subscription