Merge pull request #7161 from nupplaphil/task/mod_toggle_mobile
Move mod/toggle_mobile to src/Module/ToggleMobile
This commit is contained in:
commit
33ec3d8051
|
@ -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);
|
|
||||||
}
|
|
|
@ -207,6 +207,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