function HTTPSFileWrapper($url, &$info) { parent::HTTPFileWrapper($url, $info); $this->setDefaultPort(443); $this->setDefaultHost('ssl://localhost'); if (isset($this->info['host'])) { $this->info['host'] = 'ssl://' . $this->info['host']; } }
function __construct($url, &$info) { parent::__construct($url, $info); $this->setDefaultPort(443); $this->setDefaultHost('ssl://localhost'); if (isset($this->info['host'])) { $this->info['host'] = 'ssl://' . $this->info['host']; } }
/** * Return instance of a class for reading the specified URL. * @param $url string * @return FileWrapper */ function &wrapper($url) { $info = parse_url($url); if (ini_get('allow_url_fopen') && Config::getVar('general', 'allow_url_fopen')) { $wrapper = new FileWrapper($url, $info); } else { if (isset($info['scheme'])) { $scheme = $info['scheme']; } else { $scheme = null; } switch ($scheme) { case 'http': import('lib.pkp.classes.file.wrappers.HTTPFileWrapper'); $wrapper = new HTTPFileWrapper($url, $info); $wrapper->addHeader('User-Agent', 'PKP-OJS/2.x'); break; case 'https': import('lib.pkp.classes.file.wrappers.HTTPSFileWrapper'); $wrapper = new HTTPSFileWrapper($url, $info); $wrapper->addHeader('User-Agent', 'PKP-OJS/2.x'); break; case 'ftp': import('lib.pkp.classes.file.wrappers.FTPFileWrapper'); $wrapper = new FTPFileWrapper($url, $info); break; default: $wrapper = new FileWrapper($url, $info); } } return $wrapper; }
/** * Return instance of a class for reading the specified URL. * @param $source mixed; URL, filename, or resources * @return FileWrapper */ function &wrapper($source) { if (ini_get('allow_url_fopen') && Config::getVar('general', 'allow_url_fopen') && is_string($source)) { $info = parse_url($source); $wrapper = new FileWrapper($source, $info); } elseif (is_resource($source)) { // $source is an already-opened file descriptor. import('lib.pkp.classes.file.wrappers.ResourceWrapper'); $wrapper = new ResourceWrapper($source); } else { // $source should be a URL. $info = parse_url($source); if (isset($info['scheme'])) { $scheme = $info['scheme']; } else { $scheme = null; } switch ($scheme) { case 'http': import('lib.pkp.classes.file.wrappers.HTTPFileWrapper'); $wrapper = new HTTPFileWrapper($source, $info); $wrapper->addHeader('User-Agent', 'PKP/2.x'); break; case 'https': import('lib.pkp.classes.file.wrappers.HTTPSFileWrapper'); $wrapper = new HTTPSFileWrapper($source, $info); $wrapper->addHeader('User-Agent', 'PKP/2.x'); break; case 'ftp': import('lib.pkp.classes.file.wrappers.FTPFileWrapper'); $wrapper = new FTPFileWrapper($source, $info); break; default: $wrapper = new FileWrapper($source, $info); } } return $wrapper; }
/** * Return instance of a class for reading the specified URL. * @param $source mixed; URL, filename, or resources * @return FileWrapper */ function &wrapper($source) { if (ini_get('allow_url_fopen') && Config::getVar('general', 'allow_url_fopen') && is_string($source)) { $info = parse_url($source); $wrapper = new FileWrapper($source, $info); } elseif (is_resource($source)) { // $source is an already-opened file descriptor. import('lib.pkp.classes.file.wrappers.ResourceWrapper'); $wrapper = new ResourceWrapper($source); } else { // $source should be a URL. $info = parse_url($source); if (isset($info['scheme'])) { $scheme = $info['scheme']; } else { $scheme = null; } $application =& Application::getApplication(); if (!Config::getVar('general', 'installed') || defined('RUNNING_UPGRADE') || defined('PHPUNIT_CURRENT_MOCK_ENV')) { $userAgent = $application->getName() . '/?'; } else { $currentVersion =& $application->getCurrentVersion(); $userAgent = $application->getName() . '/' . $currentVersion->getVersionString(); } switch ($scheme) { case 'http': import('lib.pkp.classes.file.wrappers.HTTPFileWrapper'); $wrapper = new HTTPFileWrapper($source, $info); $wrapper->addHeader('User-Agent', $userAgent); break; case 'https': import('lib.pkp.classes.file.wrappers.HTTPSFileWrapper'); $wrapper = new HTTPSFileWrapper($source, $info); $wrapper->addHeader('User-Agent', $userAgent); break; case 'ftp': import('lib.pkp.classes.file.wrappers.FTPFileWrapper'); $wrapper = new FTPFileWrapper($source, $info); break; default: $wrapper = new FileWrapper($source, $info); } } return $wrapper; }