Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

64 lines (60 sloc) 2.112 kB
<?php
/**
* Implementation hook_autoload_info().
*/
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'),
);
}
/**
* Factory method for the HttpClient. Use this if you don't want to select a
* Http client delegate yourself.
*
* @param object $authentication
* @param object $formatter
* @param object $request_alter
* @param object $delegate
* @return HttpClient
*/
function http_client($authentication = NULL, $formatter = NULL, $request_alter = NULL, $delegate = NULL) {
// Allow other modules to specify the delegate.
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);
}
/**
* Implementation of hook_http_client_delegates().
*/
function http_client_http_client_delegates() {
$delegates = array();
if (function_exists('curl_init')) {
$delegates['curl'] = new HttpClientCurlDelegate();
}
return $delegates;
}
/**
* Implementation of hook_enable().
*/
function http_client_enable() {
autoload_flush_caches();
}
Jump to Line
Something went wrong with that request. Please try again.