10 defined(
'JPATH_PLATFORM') or die;
31 public static function getHttp(
JRegistry $options = null, $adapters = null)
38 return new JHttp($options, self::getAvailableDriver($options, $adapters));
51 public static function getAvailableDriver(
JRegistry $options, $default = null)
53 if (is_null($default))
55 $availableAdapters = self::getHttpTransports();
59 settype($default,
'array');
60 $availableAdapters = $default;
64 if (!count($availableAdapters))
69 foreach ($availableAdapters as $adapter)
71 $class =
'JHttpTransport' . ucfirst($adapter);
73 if ($class::isSupported())
75 return new $class($options);
89 public static function getHttpTransports()
92 $iterator =
new DirectoryIterator(__DIR__ .
'/transport');
94 foreach ($iterator as $file)
96 $fileName = $file->getFilename();
100 if ($file->isFile() && substr($fileName, strrpos($fileName,
'.') + 1) ==
'php')
102 $names[] = substr($fileName, 0, strrpos($fileName,
'.'));