Created
June 28, 2013 12:03
-
-
Save Temaruk/5884209 to your computer and use it in GitHub Desktop.
Determines if the current page call is via Services. (Drupal 6)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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