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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
<?php /* Copyright (c) 2024 Freya Murphy */
class _meta_controller extends Controller {
function __construct($load) {
parent::__construct($load);
}
public function robots() {
header("Content-Type: text/plain");
$sitemap = $this->main->get_url_full('sitemap.xml');
echo "User-agent: *\n";
echo "Disallow:\n";
echo "Crawl-delay: 5\n";
echo "Disallow: /_comments/\n";
echo "Disallow: /pacbattle/\n";
echo "Disallow: /bucket/\n";
echo "Sitemap: {$sitemap}\n";
}
private function sitemap_page($url, $priority) {
echo "<url>\n";
echo "<loc>{$this->main->get_url_full($url)}</loc>\n";
echo "<priority>{$priority}</priority>\n";
echo "</url>";
}
public function sitemap() {
header("Content-Type: application/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n";
$this->sitemap_page('home', 1);
$this->sitemap_page('projects', 0.8);
$this->sitemap_page('blog', 0.8);
$this->load->app_lang('blog');
$blog_modal = $this->load->model('blog');
$blog = $blog_modal->get_data()['blog'];
foreach ($blog as $name => $_) {
$this->sitemap_page("blog/post?name={$name}", 0.5);
}
echo "</urlset>\n";
}
public function manifest() {
$json = array(
'short_name' => lang('domain'),
'name' => lang('domain'),
'icons' => [
array(
'src' => $this->main->get_url('public/icons/logo512.png'),
'type' => 'image/png',
'sizes' => '512x512',
'purpose' => 'any maskable'
)
],
'id' => $this->main->get_url('home'),
'start_url' => $this->main->get_url('home'),
'background_color' => lang('theme_color'),
'display' => 'standalone',
'scope' => lang('base_path'),
'theme_color' => lang('theme_color'),
'shortcuts' => [],
'description' => lang('default_short_desc'),
'screenshots' => []
);
header('Content-type: application/json');
echo json_encode($json);
}
}
|