public static function URLsToArray($sitelocation) { $arrayindexes = \SimpleSitemapGenerator\XMLTools::createArray(file_get_contents($sitelocation)); //if only one element, a trick to have all elements in the same level if (isset($arrayindexes["urlset"]["url"]["loc"])) { return array($arrayindexes["urlset"]["url"]); } else { return $arrayindexes["urlset"]["url"]; } }
public static function indexToArray($filepath) { if (file_exists($filepath)) { $arrayindexes = \SimpleSitemapGenerator\XMLTools::createArray(file_get_contents($filepath)); //if only one element if (isset($arrayindexes["sitemapindex"]["sitemap"]["loc"])) { return array($arrayindexes["sitemapindex"]["sitemap"]); } else { return $arrayindexes["sitemapindex"]["sitemap"]; } } else { return array(); } }