WC_API_Server::is_xml_request()
Check if the current request accepts an XML response by checking the endpoint suffix (.xml) or the HTTP ACCEPT header
Метод класса: WC_API_Server{}
Хуков нет.
Возвращает
true|false
.
Использование
// private - только в коде основоного (родительского) класса $result = $this->is_xml_request();
Список изменений
С версии 2.1 | Введена. |
Код WC_API_Server::is_xml_request() WC API Server::is xml request WC 7.7.0
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; }