Skip to content

Instantly share code, notes, and snippets.

@Flower7C3
Created October 3, 2023 08:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Flower7C3/86bf6c9004854948e5095c9483fa92d6 to your computer and use it in GitHub Desktop.
Save Flower7C3/86bf6c9004854948e5095c9483fa92d6 to your computer and use it in GitHub Desktop.
<?php
if (is_file(__DIR__ . '/sites/sites.php')) {
$sites = [];
include __DIR__ . '/sites/sites.php';
$domains = [];
foreach ($sites as $host => $locale) {
$environment = preg_match('(site\.pride\.gl)', $host) ? 'stage' : 'prod';
[$language, $country] = explode('_', $locale);
$domains[$country][$language][$environment] = $host;
}
echo '<ul>';
foreach ($domains as $country => $languages) {
printf('<li>%s', $country);
echo '<ul>';
foreach ($languages as $language => $environments) {
printf('<li>%s', $language);
echo '<ul>';
foreach ($environments as $environment => $host) {
printf('<li>%s - <a href="https://%s">%s</a></li>', $environment, $host, $host);
}
printf('</li>');
echo '</ul>';
}
printf('</li>');
echo '</ul>';
}
echo '</ul>';
exit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment