WP_Http_Encoding::is_available() WordPress Method

The WP_Http_Encoding::is_available() method is used to check if a particular encoding type is available for use on a Wordpress site. This is useful for checking if gzip or deflate encoding is available, for example.

WP_Http_Encoding::is_available() #

Whether decompression and compression are supported by the PHP version.


Description

Each function is tested instead of checking for the zlib extension, to ensure that the functions all exist in the PHP version and aren’t disabled.


Top ↑

Return

(bool)


Top ↑

Source

File: wp-includes/class-wp-http-encoding.php

	public static function is_available() {
		return ( function_exists( 'gzuncompress' ) || function_exists( 'gzdeflate' ) || function_exists( 'gzinflate' ) );
	}


Top ↑

Changelog

Changelog
VersionDescription
2.8.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.