summaryrefslogtreecommitdiff
path: root/inc/HTTPClient.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2009-06-05 12:46:03 +0200
committerAndreas Gohr <andi@splitbrain.org>2009-06-05 12:46:03 +0200
commit3b787fa52acd8f58a58ece80238abdcafddf0155 (patch)
tree00f45a2cc6c114aa24a3e77ec8ce8c624a8fde6d /inc/HTTPClient.php
parentaac566c23cd7c7673e682def9fa3af9ad9dc4bd4 (diff)
downloadrpg-3b787fa52acd8f58a58ece80238abdcafddf0155.tar.gz
rpg-3b787fa52acd8f58a58ece80238abdcafddf0155.tar.bz2
Moved HTTPCLIENT_REQUEST_SEND event
Ignore-this: 8e7c6aae103f1bced33a74a2440c2fe8 This patch moves the HTTPCLIENT_REQUEST_SEND event from HTTPClient to DokuHTTPClient. This keeps the main HTTPClient class free from any DokuWiki specific code for easier reuse elsewhere. darcs-hash:20090605104603-7ad00-8e56892a7f20b4c7010fb2f8d54ae381f984dfc2.gz
Diffstat (limited to 'inc/HTTPClient.php')
-rw-r--r--inc/HTTPClient.php36
1 files changed, 23 insertions, 13 deletions
diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php
index 0c3b4f435..e769b0c93 100644
--- a/inc/HTTPClient.php
+++ b/inc/HTTPClient.php
@@ -35,6 +35,29 @@ class DokuHTTPClient extends HTTPClient {
$this->proxy_pass = conf_decodeString($conf['proxy']['pass']);
$this->proxy_ssl = $conf['proxy']['ssl'];
}
+
+
+ /**
+ * Wraps an event around the parent function
+ *
+ * @triggers HTTPCLIENT_REQUEST_SEND
+ * @author Andreas Gohr <andi@splitbrain.org>
+ */
+ function sendRequest($url,$data='',$method='GET'){
+ $httpdata = array('url' => $url,
+ 'data' => $data,
+ 'method' => $method);
+ $evt = new Doku_Event('HTTPCLIENT_REQUEST_SEND',$httpdata);
+ if($evt->advise_before()){
+ $url = $httpdata['url'];
+ $data = $httpdata['data'];
+ $method = $httpdata['method'];
+ }
+ $evt->advise_after();
+ unset($evt);
+ return parent::sendRequest($url,$data,$method);
+ }
+
}
/**
@@ -165,19 +188,6 @@ class HTTPClient {
unset($this->headers['Accept-encoding']);
}
-
- $httpdata = array('url' => $url,
- 'data' => $data,
- 'method' => $method);
- $evt = new Doku_Event('HTTPCLIENT_REQUEST_SEND',$httpdata);
- if($evt->advise_before()){
- $url = $httpdata['url'];
- $data = $httpdata['data'];
- $method = $httpdata['method'];
- }
- $evt->advise_after();
- unset($evt);
-
// parse URL into bits
$uri = parse_url($url);
$server = $uri['host'];