diff options
author | Christian Weber | 2010-06-02 15:24:07 +0000 |
---|---|---|
committer | Christian Weber | 2010-06-02 15:24:07 +0000 |
commit | 77d04fe9d6b1b784e9f9197ab308e09f184613ab (patch) | |
tree | e0dfbdabb486b54f8c5c656fe47bd151ed9b4d05 /it_url.class | |
parent | aa3529d9a5d81d83b7bf82a33e4e8988ac81a420 (diff) | |
download | itools-77d04fe9d6b1b784e9f9197ab308e09f184613ab.tar.gz itools-77d04fe9d6b1b784e9f9197ab308e09f184613ab.tar.bz2 itools-77d04fe9d6b1b784e9f9197ab308e09f184613ab.zip |
it_url::get() no longer creates new objects if not called statically. Added it_url::get() test cases
Diffstat (limited to 'it_url.class')
-rw-r--r-- | it_url.class | 12 |
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); |