WordPress at Your Fingertips
function is not described

WC_API_Server::is_xml_request() private WC 2.1

Check if the current request accepts an XML response by checking the endpoint suffix (.xml) or the HTTP ACCEPT header

{} It's a method of the class: WC_API_Server{}

No Hooks.

Return

true|false.

Usage

// private - for code of main (parent) class only
$result = $this->is_xml_request();

Changelog

Since 2.1 Introduced.

Code of WC_API_Server::is_xml_request() WC 5.7.1

private function is_xml_request() {

	// check path
	if ( false !== stripos( $this->path, '.xml' ) ) {
		return true;
	}

	// check headers, 'application/xml' or 'text/xml' are acceptable, see RFC 2376
	if ( isset( $this->headers['ACCEPT'] ) && ( 'application/xml' == $this->headers['ACCEPT'] || 'text/xml' == $this->headers['ACCEPT'] ) ) {
		return true;
	}

	return false;
}