add fulcrm_apiv2_url_to_type and fulcrm_apiv2_url_to_pk

This commit is contained in:
Marek Isalski 2016-03-14 10:39:45 +01:00
parent 00c06fea92
commit 2604efa9c7

View File

@ -44,6 +44,16 @@ function fulcrm_apiv2_prevent_loop( $headers ) {
return true;
}
function fulcrm_apiv2_url_to_type( $url ) {
preg_match( '/https:\/\/[^\/]+\/api\/v2\/([a-z_0-9]+)\/([0-9]+)?\//', $url, $matches );
return $matches[ 1 ];
}
function fulcrm_apiv2_url_to_pk( $url ) {
preg_match( '/https:\/\/[^\/]+\/api\/v2\/([a-z_0-9]+)\/([0-9]+)?\//', $url, $matches );
return intval( $matches[ 2 ] );
}
function fulcrm_apiv2_http( $method, $object = null, $data = null, $query = null ) {
$url = null;