]> git.mxchange.org Git - friendica.git/commitdiff
Move mod/view to src/Module/View
authorPhilipp Holzer <admin+github@philipp.info>
Sat, 18 May 2019 19:23:12 +0000 (21:23 +0200)
committerPhilipp Holzer <admin+github@philipp.info>
Sat, 18 May 2019 19:23:12 +0000 (21:23 +0200)
mod/view.php [deleted file]
src/App/Router.php
src/Module/Theme.php [new file with mode: 0644]

diff --git a/mod/view.php b/mod/view.php
deleted file mode 100644 (file)
index 6f23d84..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-
-use Friendica\App;
-use Friendica\Util\Strings;
-
-/**
- * load view/theme/$current_theme/style.php with friendica context
- *
- * @param App $a
- */
-function view_init(App $a)
-{
-       header("Content-Type: text/css");
-
-       if ($a->argc == 4) {
-               $theme = $a->argv[2];
-               $theme = Strings::sanitizeFilePathItem($theme);
-
-               // set the path for later use in the theme styles
-               $THEMEPATH = "view/theme/$theme";
-               if (file_exists("view/theme/$theme/style.php")) {
-                       require_once("view/theme/$theme/style.php");
-               }
-       }
-
-       exit();
-}
index cd59c3dd905ed28b40dbfbc7a9c89e1aee7f6457..7e4c35ff017c9e9f39d82763dc21dfdf66eae879 100644 (file)
@@ -202,6 +202,7 @@ class Router
                $this->routeCollector->addRoute(['GET'],         '/smilies[/json]',      Module\Smilies::class);
                $this->routeCollector->addRoute(['GET'],         '/statistics.json',     Module\Statistics::class);
                $this->routeCollector->addRoute(['GET'],         '/tos',                 Module\Tos::class);
+               $this->routeCollector->addRoute(['GET'],         '/view/theme/{theme:.+}',  Module\Theme::class);
                $this->routeCollector->addRoute(['GET'],         '/viewsrc/{item:\d+}',  Module\ItemBody::class);
                $this->routeCollector->addRoute(['GET'],         '/webfinger',           Module\WebFinger::class);
                $this->routeCollector->addRoute(['GET'],         '/xrd',                 Module\Xrd::class);
diff --git a/src/Module/Theme.php b/src/Module/Theme.php
new file mode 100644 (file)
index 0000000..0540267
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+
+namespace Friendica\Module;
+
+use Friendica\BaseModule;
+use Friendica\Util\Strings;
+
+/**
+ * load view/theme/$current_theme/style.php with friendica context
+ */
+class Theme extends BaseModule
+{
+       public static function rawContent()
+       {
+               header("Content-Type: text/css");
+
+               $a = self::getApp();
+
+               if ($a->argc == 4) {
+                       $theme = $a->argv[2];
+                       $theme = Strings::sanitizeFilePathItem($theme);
+
+                       // set the path for later use in the theme styles
+                       $THEMEPATH = "view/theme/$theme";
+                       if (file_exists("view/theme/$theme/style.php")) {
+                               require_once("view/theme/$theme/style.php");
+                       }
+               }
+
+               exit();
+       }
+}