wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
wp_is_xml_request › WordPress Function
Seit5.2.0
Veraltetn/v
› wp_is_xml_request ( Keine Parameter )
| Gibt zurück: |
|
| Definiert in: |
|
| Codex: |
Checks whether current request is an XML request, or is expecting an XML response.
Ähnliche Funktionen: wp_is_json_request, wp_is_jsonp_request, wp_safe_remote_request, wp_remote_request, wp_send_user_request
Quellcode
function wp_is_xml_request() {
$accepted = array(
'text/xml',
'application/rss+xml',
'application/atom+xml',
'application/rdf+xml',
'text/xml+oembed',
'application/xml+oembed',
);
if ( isset( $_SERVER['HTTP_ACCEPT'] ) ) {
foreach ( $accepted as $type ) {
if ( str_contains( $_SERVER['HTTP_ACCEPT'], $type ) ) {
return true;
}
}
}
if ( isset( $_SERVER['CONTENT_TYPE'] ) && in_array( $_SERVER['CONTENT_TYPE'], $accepted, true ) ) {
return true;
}
return false;
}