WP_Http_Encoding::decompress()public staticWP 2.8.0

Decompression of deflated string.

Will attempt to decompress using the RFC 1950 standard, and if that fails then the RFC 1951 standard deflate will be attempted. Finally, the RFC
1952 standard gzip decode will be attempted. If all fail, then the original compressed string will be returned.

Метод класса: WP_Http_Encoding{}

Хуков нет.

Возвращает

Строку|false. Decompressed string on success, false on failure.

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

$result = WP_Http_Encoding::decompress( $compressed, $length );
$compressed(строка) (обязательный)
String to decompress.
$length(int)
The optional length of the compressed data.
По умолчанию: null

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

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

Код WP_Http_Encoding::decompress() WP 6.4.3

public static function decompress( $compressed, $length = null ) {

	if ( empty( $compressed ) ) {
		return $compressed;
	}

	$decompressed = @gzinflate( $compressed );
	if ( false !== $decompressed ) {
		return $decompressed;
	}

	$decompressed = self::compatible_gzinflate( $compressed );
	if ( false !== $decompressed ) {
		return $decompressed;
	}

	$decompressed = @gzuncompress( $compressed );
	if ( false !== $decompressed ) {
		return $decompressed;
	}

	if ( function_exists( 'gzdecode' ) ) {
		$decompressed = @gzdecode( $compressed );

		if ( false !== $decompressed ) {
			return $decompressed;
		}
	}

	return $compressed;
}