]> git.mxchange.org Git - friendica.git/commitdiff
Move mod/manifset to src/Module/Manifset
authorPhilipp Holzer <admin@philipp.info>
Mon, 22 Apr 2019 10:48:40 +0000 (12:48 +0200)
committerPhilipp Holzer <admin@philipp.info>
Mon, 22 Apr 2019 10:48:40 +0000 (12:48 +0200)
mod/manifest.php [deleted file]
src/Module/Manifest.php [new file with mode: 0644]
view/templates/manifest.tpl

diff --git a/mod/manifest.php b/mod/manifest.php
deleted file mode 100644 (file)
index bdb5298..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-use Friendica\App;
-use Friendica\Core\System;
-use Friendica\Core\Config;
-use Friendica\Core\Renderer;
-
-function manifest_content(App $a) {
-
-       $tpl = Renderer::getMarkupTemplate('manifest.tpl');
-
-       header('Content-type: application/manifest+json');
-
-       $touch_icon = Config::get('system', 'touch_icon', 'images/friendica-128.png');
-       if ($touch_icon == '') {
-               $touch_icon = 'images/friendica-128.png';
-       }
-
-       $o = Renderer::replaceMacros($tpl, [
-               '$baseurl' => System::baseUrl(),
-               '$touch_icon' => $touch_icon,
-               '$title' => Config::get('config', 'sitename', 'Friendica'),
-       ]);
-
-       echo $o;
-
-       exit();
-}
diff --git a/src/Module/Manifest.php b/src/Module/Manifest.php
new file mode 100644 (file)
index 0000000..40ae538
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+
+namespace Friendica\Module;
+
+use Friendica\BaseModule;
+use Friendica\Core\Renderer;
+
+class Manifest extends BaseModule
+{
+       public static function rawContent()
+       {
+               $app = self::getApp();
+               $config = $app->getConfig();
+
+               $tpl = Renderer::getMarkupTemplate('manifest.tpl');
+
+               header('Content-type: application/manifest+json');
+
+               $touch_icon = $config->get('system', 'touch_icon', 'images/friendica-128.png');
+               if ($touch_icon == '') {
+                       $touch_icon = 'images/friendica-128.png';
+               }
+
+               $output = Renderer::replaceMacros($tpl, [
+                       '$baseurl' => $app->getBaseURL(),
+                       '$touch_icon' => $touch_icon,
+                       '$title' => $config->get('config', 'sitename', 'Friendica'),
+               ]);
+
+               echo $output;
+
+               exit();
+       }
+}
index 6f9294774da1ddcff48be642f035dcf2490b9481..b4b369cb9497df0a5a08fdef1de1ab8c3753df2b 100644 (file)
@@ -3,7 +3,7 @@
   "start_url": "{{$baseurl}}",
   "display": "standalone",
   "description": "A Decentralized Social Network",
-  "icons": [{
+  "icons": {
     "src": "{{$baseurl}}/{{$touch_icon}}"
-  }]
+  }
 }