Skip to content

Commit 09f681b

Browse files
committed
Merge pull request #2337 from MPOS/mobile-detection
Mobile detection
2 parents a3cf5ec + 67066ef commit 09f681b

File tree

3 files changed

+1262
-2
lines changed

3 files changed

+1262
-2
lines changed

include/autoloader.inc.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,18 @@
3434
require_once(INCLUDE_DIR . '/lib/swiftmailer/swift_required.php');
3535

3636
// Detect device
37-
if ( PHP_SAPI == 'cli') {
37+
require_once(INCLUDE_DIR . '/lib/Mobile_Detect.php');
38+
$detect = new Mobile_Detect;
39+
40+
if (!$detect->isMobile()) {
41+
$theme = $setting->getValue('website_mobile_theme', 'bootstrap');
42+
} else if ( PHP_SAPI == 'cli') {
3843
// Create a new compile folder just for crons
3944
// We call mail templates directly anyway
4045
$theme = 'cron';
4146
} else {
4247
// Use configured theme, fallback to default theme
43-
$setting->getValue('website_theme') ? $theme = $setting->getValue('website_theme') : $theme = 'bootstrap';
48+
$theme = $setting->getValue('website_theme', 'bootstrap');
4449
}
4550
define('THEME', $theme);
4651

include/config/admin_settings.inc.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@
6969
'name' => 'website_theme', 'value' => $setting->getValue('website_theme'),
7070
'tooltip' => 'The default theme used on your pool.'
7171
);
72+
$aSettings['website'][] = array(
73+
'display' => 'Website mobile theme', 'type' => 'select',
74+
'options' => $aThemes,
75+
'default' => 'bootstrap',
76+
'name' => 'website_mobile_theme', 'value' => $setting->getValue('website_mobile_theme'),
77+
'tooltip' => 'The mobile theme used on your pool.'
78+
);
7279
$aSettings['website'][] = array(
7380
'display' => 'Website Design', 'type' => 'select',
7481
'options' => $aDesigns,

0 commit comments

Comments
 (0)