forked from thomascube/roundcube-elastic4mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
elastic4mobile.php
37 lines (31 loc) · 1.02 KB
/
elastic4mobile.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
/**
* Elastic skin for mobile devices plugin
*
* Selects the elastic skin if a mobile device is detected as the client.
*
* @author Thomas Bruederli <[email protected]>
* @license GNU GPLv3+
*/
class elastic4mobile extends rcube_plugin
{
public $noajax = true;
public function init()
{
$rcmail = rcmail::get_instance();
// Check if the Mobile_Detect class exists
if (class_exists('Mobile_Detect')) {
$detect = new Mobile_Detect;
if ($detect->isMobile() || $detect->isTablet()) {
$skin = 'elastic';
$rcmail->default_skin = $skin;
$rcmail->config->set('skin', $skin);
$rcmail->output->set_skin($skin);
// Disable skin switch as this wouldn't have any effect
$dont_override = $rcmail->config->get('dont_override', []);
$dont_override[] = 'skin';
$rcmail->config->set('dont_override', $dont_override);
}
}
}
}