Move mod/toggle_mobile to src/Module/ToggleMobile
This commit is contained in:
parent
d252598821
commit
295d90d496
3 changed files with 31 additions and 20 deletions
|
@ -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);
|
|
||||||
}
|
|
|
@ -201,6 +201,7 @@ class Router
|
||||||
$this->routeCollector->addRoute(['GET'], '/rsd.xml', Module\ReallySimpleDiscovery::class);
|
$this->routeCollector->addRoute(['GET'], '/rsd.xml', Module\ReallySimpleDiscovery::class);
|
||||||
$this->routeCollector->addRoute(['GET'], '/smilies[/json]', Module\Smilies::class);
|
$this->routeCollector->addRoute(['GET'], '/smilies[/json]', Module\Smilies::class);
|
||||||
$this->routeCollector->addRoute(['GET'], '/statistics.json', Module\Statistics::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'], '/tos', Module\Tos::class);
|
||||||
$this->routeCollector->addRoute(['GET'], '/viewsrc/{item:\d+}', Module\ItemBody::class);
|
$this->routeCollector->addRoute(['GET'], '/viewsrc/{item:\d+}', Module\ItemBody::class);
|
||||||
$this->routeCollector->addRoute(['GET'], '/webfinger', Module\WebFinger::class);
|
$this->routeCollector->addRoute(['GET'], '/webfinger', Module\WebFinger::class);
|
||||||
|
|
30
src/Module/ToggleMobile.php
Normal file
30
src/Module/ToggleMobile.php
Normal file
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue