protected function getSitemapFromInput($options)
{
$sitemaps = array();
if ($this->validateUrl($options['sitemap'])) {
try {
$curl = $this->getCurl();
$curl->get($options['sitemap']);
if ($curl->http_status_code == '200') {
$parsedUrl = parse_url($options['sitemap']);
array_push($sitemaps, array('relative_path' => $parsedUrl['path'], 'sitemap_url' => $options['sitemap'], 'base_url' => $options['current-url']));
} else {
return false;
}
} catch (\Exception $e) {
if (!$this->_options['silent']) {
throw new \RuntimeException('Could not fetch a sitemap at ' . $options['sitemap'] . ' .');
}
return false;
}
} else {
$str = $options['sitemap'];
if (substr($options['sitemap'], 0, 1) != '/') {
$str = DIRECTORY_SEPARATOR . $str;
$pathType = 'relative';
} else {
$pathType = 'absolute';
}
if ($pathType == 'relative') {
if (file_exists($this->_magentoRootFolder . $str)) {
array_push($sitemaps, array('relative_path' => $str, 'base_url' => $options['current-url']));
} else {
return false;
}
} elseif ($pathType == 'absolute') {
if (file_exists($str)) {
array_push($sitemaps, array('relative_path' => $str, 'base_url' => $options['current-url']));
} else {
return false;
}
}
}
return $sitemaps;
}