summaryrefslogtreecommitdiff
path: root/it_url.class
diff options
context:
space:
mode:
Diffstat (limited to 'it_url.class')
-rw-r--r--it_url.class12
1 files changed, 8 insertions, 4 deletions
diff --git a/it_url.class b/it_url.class
index 09c1292..5c13770 100644
--- a/it_url.class
+++ b/it_url.class
@@ -49,7 +49,7 @@ class it_url
* Constructor: canonicalize an URL
* @param $url URL this object represents
*/
-function it_url($url, $options = array())
+function it_url($url = null, $options = array())
{
$this->rawurl = $url;
@@ -237,10 +237,14 @@ function get($p=null, $timeout=5)
$p += array('totaltimeout' => "999999", 'timeout' => 5, 'retries' => 1);
- if (isset($p['url']))
+ if ($this instanceof it_url)
+ {
+ $url = $this;
+ if ($p['url'])
+ $this->it_url($p['url']);
+ }
+ else # called statically
$url = new it_url($p['url']);
- else
- $url =& $this; # Must be reference for $url->result and $url->data to work
$url->result = $result = false;
unset($url->data);