From a5512610906942fd4dab00bd1ee74d604a4a3dc6 Mon Sep 17 00:00:00 2001 From: Marek Isalski Date: Tue, 19 Apr 2016 12:28:43 +0100 Subject: [PATCH] add fulcrm_apiv2_client_id() --- fulcrm_apiv2.module | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fulcrm_apiv2.module b/fulcrm_apiv2.module index d04d4b5..b180f03 100644 --- a/fulcrm_apiv2.module +++ b/fulcrm_apiv2.module @@ -30,12 +30,16 @@ function fulcrm_apiv2_menu() { return $items; } +function fulcrm_apiv2_client_id() { + return variable_get( 'fulcrm_apiv2_client_id', $GLOBALS[ 'base_url' ] ); +} + function fulcrm_apiv2_prevent_loop( $headers ) { $incoming_client_ids = &drupal_static(__FUNCTION__); if ( array_key_exists( 'X-fulcrm-Client-ID', $headers ) ) { $incoming_client_ids = array_map( "trim", explode( ',', $headers[ 'X-fulcrm-Client-ID' ] ) ); - $client_id = variable_get( 'fulcrm_apiv2_client_id', $GLOBALS[ 'base_url' ] ); + $client_id = fulcrm_apiv2_client_id(); if ( in_array( $client_id, $incoming_client_ids ) ) return false; } else { @@ -119,7 +123,7 @@ function fulcrm_apiv2_http( $method, $object = null, $data = null, $query = null $incoming_client_ids = &drupal_static( 'fulcrm_apiv2_prevent_loop' ); if ( !is_array( $incoming_client_ids ) ) $incoming_client_ids = array(); - $incoming_client_ids[] = variable_get( 'fulcrm_apiv2_client_id', $GLOBALS[ 'base_url' ] ); + $incoming_client_ids[] = fulcrm_apiv2_client_id(); $request_headers[] = 'X-fulcrm-Client-ID: ' . implode( ', ', $incoming_client_ids );