WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Платформа для конвертации и монетизации трафика
функция не описана

WP_Http_Encoding::compatible_gzinflate() public WP 2.8.1

Decompression of deflated string while staying compatible with the majority of servers.

Certain Servers will return deflated data with headers which PHP's gzinflate() function cannot handle out of the box. The following function has been created from various snippets on the gzinflate() PHP documentation.

Warning: Magic numbers within. Due to the potential different formats that the compressed data may be returned in, some "magic offsets" are needed to ensure proper decompression takes place. For a simple progmatic way to determine the magic offset in use, see: https://core.trac.wordpress.org/ticket/18273

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

Хуков нет.

Возвращает

Строку/true/false. False on failure.

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

$result = WP_Http_Encoding::compatible_gzinflate( $gzData );
$gzData(строка) (обязательный)
String to decompress.

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

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

Код WP_Http_Encoding::compatible_gzinflate() WP 5.5.3

<?php
public static function compatible_gzinflate( $gzData ) {

	// Compressed data might contain a full header, if so strip it for gzinflate().
	if ( "\x1f\x8b\x08" === substr( $gzData, 0, 3 ) ) {
		$i   = 10;
		$flg = ord( substr( $gzData, 3, 1 ) );
		if ( $flg > 0 ) {
			if ( $flg & 4 ) {
				list($xlen) = unpack( 'v', substr( $gzData, $i, 2 ) );
				$i          = $i + 2 + $xlen;
			}
			if ( $flg & 8 ) {
				$i = strpos( $gzData, "\0", $i ) + 1;
			}
			if ( $flg & 16 ) {
				$i = strpos( $gzData, "\0", $i ) + 1;
			}
			if ( $flg & 2 ) {
				$i = $i + 2;
			}
		}
		$decompressed = @gzinflate( substr( $gzData, $i, -8 ) );
		if ( false !== $decompressed ) {
			return $decompressed;
		}
	}

	// Compressed data from java.util.zip.Deflater amongst others.
	$decompressed = @gzinflate( substr( $gzData, 2 ) );
	if ( false !== $decompressed ) {
		return $decompressed;
	}

	return false;
}