10 defined(
'JPATH_PLATFORM') or die;
33 public static function remotefsize($url)
35 $sch = parse_url($url, PHP_URL_SCHEME);
37 if (($sch !=
'http') && ($sch !=
'https') && ($sch !=
'ftp') && ($sch !=
'ftps'))
42 if (($sch ==
'http') || ($sch ==
'https'))
44 $headers = get_headers($url, 1);
46 if ((!array_key_exists(
'Content-Length', $headers)))
51 return $headers[
'Content-Length'];
54 if (($sch ==
'ftp') || ($sch ==
'ftps'))
56 $server = parse_url($url, PHP_URL_HOST);
57 $port = parse_url($url, PHP_URL_PORT);
58 $path = parse_url($url, PHP_URL_PATH);
59 $user = parse_url($url, PHP_URL_USER);
60 $pass = parse_url($url, PHP_URL_PASS);
62 if ((!$server) || (!$path))
85 $ftpid = ftp_connect($server, $port);
89 $ftpid = ftp_ssl_connect($server, $port);
98 $login = ftp_login($ftpid, $user, $pass);
105 $ftpsize = ftp_size($ftpid, $path);
128 public static function ftpChmod($url, $mode)
130 $sch = parse_url($url, PHP_URL_SCHEME);
132 if (($sch !=
'ftp') && ($sch !=
'ftps'))
137 $server = parse_url($url, PHP_URL_HOST);
138 $port = parse_url($url, PHP_URL_PORT);
139 $path = parse_url($url, PHP_URL_PATH);
140 $user = parse_url($url, PHP_URL_USER);
141 $pass = parse_url($url, PHP_URL_PASS);
143 if ((!$server) || (!$path))
166 $ftpid = ftp_connect($server, $port);
170 $ftpid = ftp_ssl_connect($server, $port);
179 $login = ftp_login($ftpid, $user, $pass);
186 $res = ftp_chmod($ftpid, $mode, $path);
199 public static function getWriteModes()
201 return array(
'w',
'w+',
'a',
'a+',
'r+',
'x',
'x+');
214 public static function getSupported()
221 $streams = array_merge(stream_get_wrappers(), self::getJStreams());
234 public static function getTransports()
237 return stream_get_transports();
247 public static function getFilters()
251 return stream_get_filters();
261 public static function getJStreams()
263 static $streams = array();
267 $files =
new DirectoryIterator(__DIR__ .
'/streams');
269 foreach ($files as $file)
271 $filename = $file->getFilename();
275 if (!$file->isFile() || substr($filename, strrpos($filename,
'.') + 1) !=
'php')
280 $streams[] = $file->getBasename(
'.php');
296 public static function isJoomlaStream($streamname)
298 return in_array($streamname, self::getJStreams());