View source
<?php
function http_client_autoload_info() {
return array(
'HttpClient' => array(
'file' => 'includes/HttpClient.inc',
),
'HttpClientDelegate' => array(
'file' => 'includes/HttpClient.inc',
),
'HttpClientException' => array(
'file' => 'includes/HttpClient.inc',
),
'HttpClientBaseFormatter' => array(
'file' => 'includes/HttpClient.inc',
),
'HttpClientFormatter' => array(
'file' => 'includes/HttpClient.inc',
),
'HttpClientAuthentication' => array(
'file' => 'includes/HttpClient.inc',
),
'HttpClientRequest' => array(
'file' => 'includes/HttpClient.inc',
),
'HttpClientCurlDelegate' => array(
'file' => 'includes/HttpClientCurlDelegate.inc',
),
'HttpClientXMLFormatter' => array(
'file' => 'includes/HttpClientXMLFormatter.inc',
),
);
}
function http_client($authentication = NULL, $formatter = NULL, $request_alter = NULL, $delegate = NULL) {
if (!$delegate) {
$delegates = array();
foreach (module_implements('http_client_delegates') as $module) {
$res = call_user_func($module . '_http_client_delegates');
if (is_array($res)) {
$delegates = $res + $delegates;
}
}
drupal_alter('http_client_delegates', $delegates);
if (!empty($delegates)) {
$delegate = array_pop($delegates);
}
}
return new HttpClient($authentication, $formatter, $request_alter, $delegate);
}
function http_client_http_client_delegates() {
$delegates = array();
if (function_exists('curl_init')) {
$delegates['curl'] = new HttpClientCurlDelegate();
}
return $delegates;
}
function http_client_enable() {
autoload_flush_caches();
}