Skip to main content

Gravity_Forms\Gravity_Forms\Settings\GF_Settings_Encryption

Class GF_Settings_Encryption

Since: 2.7.17 (Provides functionality for handling the encryption and decryption of settings)

Source: includes/settings/class-gf-settings-encryption.php:17

Details

  • Kind: class
  • Namespace: Gravity_Forms\Gravity_Forms\Settings

Methods

MethodDescription
__construct()Constructor.
is_enabled()Determines if settings encryption is enabled.
get_key()Returns the value of the GF_ENCRYPTION_KEY constant for the settings page.
encrypt()Will encrypt a settings array given it has encryption enabled, is not an empty array, and is not currently encrypted.
decrypt()Will decrypt settings given it has encryption enabled and is currently encrypted.
get_wrapper()For encrypted settings, returns the decoded JSON wrapper.
decrypt_feed_meta()When encryption is enabled, will decrypt all fields that are encrypted and return the resulting array.
encrypt_feed_meta()When encryption is enabled, will encrypt all fields marked for encryption and return the resulting array.

Method Reference

__construct()

function __construct( $encryption_key='' )

Constructor.

Parameters

NameTypeDefaultDescription
$encryption_keystring''Encryption key to use for encrypting / decrypting settings. Defaults to GF_ENCRYPTION_KEY constant.

Returns

  • void

Since: 2.7.17

Source: includes/settings/class-gf-settings-encryption.php:37

is_enabled()

public function is_enabled()

Determines if settings encryption is enabled.

Returns

  • bool — True if settings encryption is enabled. False otherwise.

Since: 2.7.17

Source: includes/settings/class-gf-settings-encryption.php:53

get_key()

public function get_key()

Returns the value of the GF_ENCRYPTION_KEY constant for the settings page.

Returns

  • string — The value of the GF_ENCRYPTION_KEY constant.

Since: 2.7.17

Source: includes/settings/class-gf-settings-encryption.php:64

encrypt()

public function encrypt( $settings )

Will encrypt a settings array given it has encryption enabled, is not an empty array, and is not currently encrypted.

Parameters

NameTypeDefaultDescription
$settingsarrayAn array of settings values

Returns

  • false | mixed | string — Will return a json block containing the encrypted setting values, otherwise returns original setting values.

Since: 2.7.17

Source: includes/settings/class-gf-settings-encryption.php:77

decrypt()

public function decrypt( $settings )

Will decrypt settings given it has encryption enabled and is currently encrypted.

Parameters

NameTypeDefaultDescription
$settings

Returns

  • mixed — Will return the decrypted settings values, otherwise returns original settings values.

Since: 2.7.17

Source: includes/settings/class-gf-settings-encryption.php:105

get_wrapper()

public function get_wrapper( $setting )

For encrypted settings, returns the decoded JSON wrapper.

Parameters

NameTypeDefaultDescription
$settingstringa settings value

Returns

  • bool — returns the decoded JSON wrapper for encrypted settings, otherwise returns the original settings.

Since: 2.7.17

Source: includes/settings/class-gf-settings-encryption.php:128

decrypt_feed_meta()

public function decrypt_feed_meta( $meta )

When encryption is enabled, will decrypt all fields that are encrypted and return the resulting array.

Parameters

NameTypeDefaultDescription
$metaarray The feed meta array.

Returns

  • array — Returns the feed meta array with all fields decrypted.

Since: 2.7.17

Source: includes/settings/class-gf-settings-encryption.php:150

encrypt_feed_meta()

public function encrypt_feed_meta( $meta, $fields_to_encrypt=[] )

When encryption is enabled, will encrypt all fields marked for encryption and return the resulting array.

Parameters

NameTypeDefaultDescription
$metaarray The feed meta array.
$fields_to_encrypt[]array The array of field names to encrypt.

Returns

  • array — Returns the feed meta array with all fields marked for encryption encrypted.

Since: 2.7.17

Source: includes/settings/class-gf-settings-encryption.php:175