Advertisement
Guest User

Untitled

a guest
Oct 6th, 2015
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. $api_check = FALSE;
  2. $headers = getallheaders();
  3. foreach($headers as $key => $value) {
  4. if (stripos($key, 'X-API') !== FALSE) {
  5. $api_check = TRUE;
  6. }
  7. }
  8. // you get the idea ^
  9. // so contrib modules can get patches to opt-out of expensive hook_init/hook_boot or whatever rendering
  10. // needs that may be horribly expensive and unnecessary for an API call
  11.  
  12. // eg
  13. // some_awesome_module_init() {
  14. // if (i_can_has_api()) {
  15. // return;
  16. // }
  17. // // beautiful, world-changing code that sadly does not help w/ teh JSONs...
  18. // }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement