Skip to main content

Gravity_Forms\Gravity_Forms\License\GF_License_API_Response

Class GF_License_API_Response

Concrete Response class for the GF License API.

Since: 2.5.11

Source: includes/license/class-gf-license-api-response.php:17

Details

  • Kind: class
  • Namespace: Gravity_Forms\Gravity_Forms\License
  • Extends: GF_API_Response

Methods

MethodDescription
__construct()GF_License_API_Response constructor.
is_valid()Whether this license key is valid.
get_error_message()Get the error message for the response, either the first one by default, or at a specific index.
get_display_status()Get the human-readable display status for the response.
get_usability()Licenses can be valid and usable, technically-invalid but still usable, or invalid and unusable.
get_upgrade_link()Get a properly-formatted link to the Upgrade page for this license key.
get_cta()Get the CTA information for this license key, if applicable.
display_as_valid()Some statuses are invalid, but get treated as usable. This determines if they should be displayed as
can_be_used()Whether the license key can be used.
has_expiration()Determine if the contained License Key has an expiration date.
renewal_text()Get the text for the renewal message.
renewal_date()Returns the license renewal or expiry date or the doesn't expire message.
max_seats_exceeded()Whether the license has max seats exceeded.
__serialize()Prepares the object for serializing.
__unserialize()Hydrates the object when unserializing.

Method Reference

__construct()

public function __construct( $data, $validate, GF_Transient_Strategy $transient_strategy )

GF_License_API_Response constructor.

Parameters

NameTypeDefaultDescription
$datamixedThe data from the API connector.
$validateboolWhether to validate the data passed.
$transient_strategyGF_Transient_StrategyThe Transient Strategy used to store things in transients.

Since: 2.5.11

Source: includes/license/class-gf-license-api-response.php:33

is_valid()

public function is_valid()

Whether this license key is valid.

Returns

  • bool

Since: 2.5.11

Source: includes/license/class-gf-license-api-response.php:108

get_error_message()

public function get_error_message( $index=0 )

Get the error message for the response, either the first one by default, or at a specific index.

Parameters

NameTypeDefaultDescription
$indexint0The array index to use if mulitple errors exist.

Returns

  • mixed | string

Since: 2.5.11

Source: includes/license/class-gf-license-api-response.php:129

get_display_status()

public function get_display_status()

Get the human-readable display status for the response.

Returns

  • string | void

Since: 2.5.11

Source: includes/license/class-gf-license-api-response.php:144

get_usability()

public function get_usability()

Licenses can be valid and usable, technically-invalid but still usable, or invalid and unusable.

This will return the correct usability value for this license key.

Returns

  • string

Since: 2.5.11

Source: includes/license/class-gf-license-api-response.php:169

public function get_upgrade_link()

Get a properly-formatted link to the Upgrade page for this license key.

Returns

  • string

Since: 2.5.11

Source: includes/license/class-gf-license-api-response.php:203

get_cta()

public function get_cta()

Get the CTA information for this license key, if applicable.

Returns

  • mixed

Since: 2.5.11

Source: includes/license/class-gf-license-api-response.php:217

display_as_valid()

public function display_as_valid()

Some statuses are invalid, but get treated as usable. This determines if they should be displayed as

though they are valid.

Returns

  • bool

Since: 2.5.11

Source: includes/license/class-gf-license-api-response.php:253

can_be_used()

public function can_be_used()

Whether the license key can be used.

Returns

  • bool

Since: 2.5.11

Source: includes/license/class-gf-license-api-response.php:275

has_expiration()

public function has_expiration()

Determine if the contained License Key has an expiration date.

Returns

  • bool

Since: 2.5.11

Source: includes/license/class-gf-license-api-response.php:286

renewal_text()

public function renewal_text()

Get the text for the renewal message.

Returns

  • string

Since: 2.5.11

Source: includes/license/class-gf-license-api-response.php:297

renewal_date()

public function renewal_date()

Returns the license renewal or expiry date or the doesn't expire message.

Returns

  • string | void

Since: 2.6.2

Source: includes/license/class-gf-license-api-response.php:319

max_seats_exceeded()

public function max_seats_exceeded()

Whether the license has max seats exceeded.

Returns

  • bool

Since: 2.5.11

Source: includes/license/class-gf-license-api-response.php:339

__serialize()

public function __serialize()

Prepares the object for serializing.

Returns

  • array

Since: 2.6.2

Source: includes/license/class-gf-license-api-response.php:354

__unserialize()

public function __unserialize( $data )

Hydrates the object when unserializing.

Parameters

NameTypeDefaultDescription
$dataarrayThe unserialized data.

Returns

  • void

Since: 2.6.2

Source: includes/license/class-gf-license-api-response.php:373