Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Temaruk
Created June 28, 2013 12:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Temaruk/5884209 to your computer and use it in GitHub Desktop.
Save Temaruk/5884209 to your computer and use it in GitHub Desktop.
Determines if the current page call is via Services. (Drupal 6)
<?php
/**
* Determines if the current page call is via Services.
*
* @return bool
* TRUE if request is via Services, FALSE otherwise.
*/
function _determine_if_call_via_services() {
$args = arg();
$services_endpoints = array_flip(array_keys(services_endpoint_load_all()));
if (array_key_exists($args[0], $services_endpoints)) {
$service_resources_raw = services_get_resources($args[0]);
$service_resources = array_flip(array_keys($service_resources_raw));
return in_array($args[1], $service_resources);
}
else {
return FALSE;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment