-
Notifications
You must be signed in to change notification settings - Fork 376
Expand file tree
/
Copy pathsitemap.php
More file actions
28 lines (20 loc) · 752 Bytes
/
sitemap.php
File metadata and controls
28 lines (20 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
$files = glob(__DIR__.'/public/*/index.php');
$files = array_merge($files, glob(__DIR__.'/public/*/*/index.php'));
$files = array_merge($files, glob(__DIR__.'/public/*/*/*/index.php'));
$files = array_merge($files, glob(__DIR__.'/public/*/*/*/*/index.php'));
$paths = [];
$paths[] = '/';
foreach($files as $file) {
preg_match('~public(/.+/)index\.php~', $file, $match);
$paths[] = $match[1];
}
$languages = json_decode(file_get_contents(__DIR__.'/data/code/languages.json'), true);
foreach($languages as $lang) {
$paths[] = '/code/' . $lang['path'] . '/';
}
$paths = array_map(function($a){
return 'https://oauth.net' . $a;
}, $paths);
$sitemap = implode("\n", $paths);
file_put_contents(__DIR__.'/public/sitemap.txt', $sitemap);