WP_Http_Encoding::accept_encoding()
What encoding types to accept and their priority values.
Метод класса: WP_Http_Encoding{}
Хуки из метода
Возвращает
Строку
. Types of encoding to accept.
Использование
$result = WP_Http_Encoding::accept_encoding( $url, $args );
- $url(строка) (обязательный)
- -
- $args(массив) (обязательный)
- -
Список изменений
С версии 2.8.0 | Введена. |
Код WP_Http_Encoding::accept_encoding() WP Http Encoding::accept encoding WP 6.2.2
public static function accept_encoding( $url, $args ) { $type = array(); $compression_enabled = self::is_available(); if ( ! $args['decompress'] ) { // Decompression specifically disabled. $compression_enabled = false; } elseif ( $args['stream'] ) { // Disable when streaming to file. $compression_enabled = false; } elseif ( isset( $args['limit_response_size'] ) ) { // If only partial content is being requested, we won't be able to decompress it. $compression_enabled = false; } if ( $compression_enabled ) { if ( function_exists( 'gzinflate' ) ) { $type[] = 'deflate;q=1.0'; } if ( function_exists( 'gzuncompress' ) ) { $type[] = 'compress;q=0.5'; } if ( function_exists( 'gzdecode' ) ) { $type[] = 'gzip;q=0.5'; } } /** * Filters the allowed encoding types. * * @since 3.6.0 * * @param string[] $type Array of what encoding types to accept and their priority values. * @param string $url URL of the HTTP request. * @param array $args HTTP request arguments. */ $type = apply_filters( 'wp_http_accept_encoding', $type, $url, $args ); return implode( ', ', $type ); }