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

diff --git a/mod/toggle_mobile.php b/mod/toggle_mobile.php
deleted file mode 100644 (file)
index d1a26b3..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-
-use Friendica\App;
-
-function toggle_mobile_init(App $a) {
-
-       if (isset($_GET['off'])) {
-               $_SESSION['show-mobile'] = false;
-       } else {
-               $_SESSION['show-mobile'] = true;
-       }
-
-       if (isset($_GET['address'])) {
-               $address = $_GET['address'];
-       } else {
-               $address = '';
-       }
-
-       $a->redirect($address);
-}
index cd59c3dd905ed28b40dbfbc7a9c89e1aee7f6457..d35b86fd74d7d93838721b383c711e0ddc8c96a4 100644 (file)
@@ -201,6 +201,7 @@ class Router
                $this->routeCollector->addRoute(['GET'],         '/rsd.xml',             Module\ReallySimpleDiscovery::class);
                $this->routeCollector->addRoute(['GET'],         '/smilies[/json]',      Module\Smilies::class);
                $this->routeCollector->addRoute(['GET'],         '/statistics.json',     Module\Statistics::class);
+               $this->routeCollector->addRoute(['GET'],         '/toggle_mobile',       Module\ToggleMobile::class);
                $this->routeCollector->addRoute(['GET'],         '/tos',                 Module\Tos::class);
                $this->routeCollector->addRoute(['GET'],         '/viewsrc/{item:\d+}',  Module\ItemBody::class);
                $this->routeCollector->addRoute(['GET'],         '/webfinger',           Module\WebFinger::class);
diff --git a/src/Module/ToggleMobile.php b/src/Module/ToggleMobile.php
new file mode 100644 (file)
index 0000000..9788c0b
--- /dev/null
@@ -0,0 +1,30 @@
+<?php
+
+namespace Friendica\Module;
+
+use Friendica\BaseModule;
+
+/**
+ * Toggles the mobile view (on/off)
+ */
+class ToggleMobile extends BaseModule
+{
+       public static function content()
+       {
+               $a = self::getApp();
+
+               if (isset($_GET['off'])) {
+                       $_SESSION['show-mobile'] = false;
+               } else {
+                       $_SESSION['show-mobile'] = true;
+               }
+
+               if (isset($_GET['address'])) {
+                       $address = $_GET['address'];
+               } else {
+                       $address = '';
+               }
+
+               $a->redirect($address);
+       }
+}