5 use dokuwiki\Extension\Event
;
9 public function sendManifest()
11 $manifest = retrieveConfig('manifest', 'jsonToArray');
15 $manifest['scope'] = DOKU_REL
;
17 if (empty($manifest['name'])) {
18 $manifest['name'] = $conf['title'];
21 if (empty($manifest['short_name'])) {
22 $manifest['short_name'] = $conf['title'];
25 if (empty($manifest['description'])) {
26 $manifest['description'] = $conf['tagline'];
29 if (empty($manifest['start_url'])) {
30 $manifest['start_url'] = DOKU_REL
;
33 $styleUtil = new \dokuwiki\
StyleUtils();
34 $styleIni = $styleUtil->cssStyleini();
35 $replacements = $styleIni['replacements'];
37 if (empty($manifest['background_color'])) {
38 $manifest['background_color'] = $replacements['__background__'];
41 if (empty($manifest['theme_color'])) {
42 $manifest['theme_color'] = !empty($replacements['__theme_color__'])
43 ?
$replacements['__theme_color__']
44 : $replacements['__background_alt__'];
47 if (empty($manifest['icons'])) {
48 $manifest['icons'] = [];
49 if (file_exists(mediaFN(':wiki:favicon.ico'))) {
50 $url = ml(':wiki:favicon.ico', '', true, '', true);
51 $manifest['icons'][] = [
63 foreach ($look as $svgLogo) {
65 $svgLogoFN = mediaFN($svgLogo);
67 if (file_exists($svgLogoFN)) {
68 $url = ml($svgLogo, '', true, '', true);
69 $manifest['icons'][] = [
71 'sizes' => '17x17 512x512',
72 'type' => 'image/svg+xml',
79 Event
::createAndTrigger('MANIFEST_SEND', $manifest);
81 header('Content-Type: application/manifest+json');
82 echo json_encode($manifest);