acf_decrypt()ACF 5.5.8

acf_decrypt

This function will decrypt an encrypted string using PHP https://bhoover.com/using-php-openssl_encrypt-openssl_decrypt-encrypt-decrypt-data/

Хуков нет.

Возвращает

(Строку).

Использование

acf_decrypt( $data );
$data **
-
По умолчанию: ''

Список изменений

С версии 5.5.8 Введена.

Код acf_decrypt() ACF 6.0.4

function acf_decrypt( $data = '' ) {

	// bail early if no decrypt function
	if ( ! function_exists( 'openssl_decrypt' ) ) {
		return base64_decode( $data );
	}

	// generate a key
	$key = wp_hash( 'acf_encrypt' );

	// To decrypt, split the encrypted data from our IV - our unique separator used was "::"
	list($encrypted_data, $iv) = explode( '::', base64_decode( $data ), 2 );

	// decrypt
	return openssl_decrypt( $encrypted_data, 'aes-256-cbc', $key, 0, $iv );

}