src/Modules/Licenser.php
public function check_license() {
		$status = $this->get_license_status();
		if ( 'not_active' == $status ) {
			$license_data          = new \stdClass();
			$license_data->license = 'not_active';

			return $license_data;
		}
		$license    = trim( $this->license_key );
		$api_params = array(
			'edd_action' => 'check_license',
			'license'    => $license,
			'item_name'  => rawurlencode( $this->product->get_name() ),
			'url'        => rawurlencode( home_url() ),
		);
		// Call the custom API.
		$response = wp_remote_get(
			add_query_arg( $api_params, $this->get_api_url() ),
			array(
				'timeout'   => 15,
				'sslverify' => false,
			)
		);
		if ( is_wp_error( $response ) ) {
			$license_data          = new \stdClass();
			$license_data->license = 'valid';

		} else {
			$license_data = json_decode( wp_remote_retrieve_body( $response ) );
			if ( ! is_object( $license_data ) ) {
				$license_data          = new \stdClass();
				$license_data->license = 'valid';
			}
		}
		$license_old = get_option( $this->product->get_key() . '_license_data', '' );
		if ( 'valid' == $license_old->license && ( $license_data->license != $license_old->license ) ) {
			$this->increment_failed_checks();
		} else {
			$this->reset_failed_checks();
		}

		if ( $this->failed_checks <= self::$max_failed ) {
			return $license_old;
		}

		if ( isset( $license_old->hide_valid ) ) {
			$license_data->hide_valid = true;
		}

		if ( ! isset( $license_data->key ) ) {
			$license_data->key = isset( $license_old->key ) ? $license_old->key : '';
		}

		if ( isset( $license_old->hide_expiration ) ) {
			$license_data->hide_expiration = true;
		}

		if ( isset( $license_old->hide_activation ) ) {
			$license_data->hide_activation = true;
		}

		return $license_data;

	}
public function check_license() {
		$status = $this->get_license_status();
		if ( 'not_active' == $status ) {
			$license_data          = new \stdClass();
			$license_data->license = 'not_active';

			return $license_data;
		}
		$license    = trim( $this->license_key );
		$api_params = array(
			'edd_action' => 'check_license',
			'license'    => $license,
			'item_name'  => rawurlencode( $this->product->get_name() ),
			'url'        => rawurlencode( home_url() ),
		);
		// Call the custom API.
		$response = wp_remote_get(
			add_query_arg( $api_params, $this->get_api_url() ),
			array(
				'timeout'   => 15,
				'sslverify' => false,
			)
		);
		if ( is_wp_error( $response ) ) {
			$license_data          = new \stdClass();
			$license_data->license = 'valid';

		} else {
			$license_data = json_decode( wp_remote_retrieve_body( $response ) );
			if ( ! is_object( $license_data ) ) {
				$license_data          = new \stdClass();
				$license_data->license = 'valid';
			}
		}
		$license_old = get_option( $this->product->get_key() . '_license_data', '' );
		if ( 'valid' == $license_old->license && ( $license_data->license != $license_old->license ) ) {
			$this->increment_failed_checks();
		} else {
			$this->reset_failed_checks();
		}

		if ( $this->failed_checks <= self::$max_failed ) {
			return $license_old;
		}

		if ( isset( $license_old->hide_valid ) ) {
			$license_data->hide_valid = true;
		}

		if ( ! isset( $license_data->key ) ) {
			$license_data->key = isset( $license_old->key ) ? $license_old->key : '';
		}

		if ( isset( $license_old->hide_expiration ) ) {
			$license_data->hide_expiration = true;
		}

		if ( isset( $license_old->hide_activation ) ) {
			$license_data->hide_activation = true;
		}

		return $license_data;

	}
public function check_license ( ) { $ status = $ this -> get_license_status ( ) ; if ( 'not_active' == $ status ) { $ license_data = new \ stdClass ( ) ; $ license_data -> license = 'not_active' ; return $ license_data ; } $ license = trim ( $ this -> license_key ) ; $ api_params = array ( 'edd_action' => 'check_license' , 'license' => $ license , 'item_name' => rawurlencode ( $ this -> product -> get_name ( ) ) , 'url' => rawurlencode ( home_url ( ) ) , ) ; // Call the custom API. $ response = wp_remote_get ( add_query_arg ( $ api_params , $ this -> get_api_url ( ) ) , array ( 'timeout' => 15 , 'sslverify' => false , ) ) ; if ( is_wp_error ( $ response ) ) { $ license_data = new \ stdClass ( ) ; $ license_data -> license = 'valid' ; } else { $ license_data = json_decode ( wp_remote_retrieve_body ( $ response ) ) ; if ( ! is_object ( $ license_data ) ) { $ license_data = new \ stdClass ( ) ; $ license_data -> license = 'valid' ; } } $ license_old = get_option ( $ this -> product -> get_key ( ) . '_license_data' , '' ) ; if ( 'valid' == $ license_old -> license && ( $ license_data -> license != $ license_old -> license ) ) { $ this -> increment_failed_checks ( ) ; } else { $ this -> reset_failed_checks ( ) ; } if ( $ this -> failed_checks <= self :: $ max_failed ) { return $ license_old ; } if ( isset ( $ license_old -> hide_valid ) ) { $ license_data -> hide_valid = true ; } if ( ! isset ( $ license_data -> key ) ) { $ license_data -> key = isset ( $ license_old -> key ) ? $ license_old -> key : '' ; } if ( isset ( $ license_old -> hide_expiration ) ) { $ license_data -> hide_expiration = true ; } if ( isset ( $ license_old -> hide_activation ) ) { $ license_data -> hide_activation = true ; } return $ license_data ; }
Check the license status.

@return object The license data.
Check the license status .