+++ /dev/null
-<?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);
-}
$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);
--- /dev/null
+<?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);
+ }
+}