summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it_url.class18
1 files changed, 10 insertions, 8 deletions
diff --git a/it_url.class b/it_url.class
index f9b9e34..a89ad19 100644
--- a/it_url.class
+++ b/it_url.class
@@ -37,6 +37,8 @@ class it_url
var $data; /* Data part, even if return code is not 200 */
var $result; /* Return code of get() */
var $redir = 0; /* Redirect count */
+ var $header; /* http header */
+ var $errstr; /* request error string */
/**
@@ -447,7 +449,7 @@ function get_multi($p=null)
* @param $p['cachedir'] directory to store cache files in, defaults to $ULTRAHOME/var/urlcache
* @param $p['id'] If you need more than one type of cache (e.g. different maxage) you can specify an id
*/
-function get_cache_dir($p)
+static function get_cache_dir($p)
{
$p += array('cachedir' => $GLOBALS['ULTRAHOME'] . "/var/urlcache", 'id' => "default");
return rtrim($p['cachedir'] . "/" . $p['id'], "/");
@@ -460,7 +462,7 @@ function get_cache_dir($p)
* @param $p['cachedir'] directory to store cache files in, @see get_cache_dir
* @param $p['id'] If you need more than one type of cache (e.g. different maxage) you can specify an id
*/
-function get_cache_filename($p)
+static function get_cache_filename($p)
{
if (!is_array($p))
$p = array('url'=>$p);
@@ -608,7 +610,7 @@ function get_cache($p = array())
/**
* Fetch a file, cache it and return contents
- * @param see it_url::get_cache
+ * Params see it_url::get_cache
*/
function get_cache_contents($p)
{
@@ -621,7 +623,7 @@ function get_cache_contents($p)
* @param $maxage Maximum age of file in seconds
* @return Not expired: false | Non-existant file: true | Timestamp of expired file
*/
-function _expired($path, $maxage)
+static function _expired($path, $maxage)
{
if ($result = EDC('nocache') ? false : @filemtime($path))
{
@@ -641,7 +643,7 @@ function _expired($path, $maxage)
* @param $path File to lock
* @return Lock handle if successfully locked file
*/
-function _lock($path)
+static function _lock($path)
{
$force = EDC('nocache') || (($mtime = @filemtime("$path.lock")) && (time() - $mtime > 30)); # expire forgotten locks
return @fopen("$path.lock", $force ? "w" : "x");
@@ -652,7 +654,7 @@ function _lock($path)
* @param $path File to unlock
* @param $lock Handle to lock acquird by _lock
*/
-function _unlock($path, $lock)
+static function _unlock($path, $lock)
{
fclose($lock);
@unlink("$path.lock");
@@ -664,7 +666,7 @@ function _unlock($path, $lock)
* @param $p Wait parameters, see @get_cache
* @return Whether lock was released within timeout and file is still there
*/
-function _waitforlockedfile($path, $p)
+static function _waitforlockedfile($path, $p)
{
$sleeptime = 0.1; # seconds to wait per pass
@@ -687,7 +689,7 @@ function _waitforlockedfile($path, $p)
* @param $data Data to write | true to just touch file
* @return True if data was written to file
*/
-function _atomicwrite($path, $data)
+static function _atomicwrite($path, $data)
{
$result = false;