[RE-ADDED] Mobile detection in PHP
* Allow users to define a seperate mobile template * Defaults to bootstrap * Disconnects desktop sites from mobile sites Fixes #2329 once merged
This commit is contained in:
parent
a3cf5ecb2b
commit
a6c587cefe
@ -34,13 +34,18 @@ if (file_exists(CLASS_DIR . '/coins/coin_' . $config['algorithm'] . '.class.php'
|
|||||||
require_once(INCLUDE_DIR . '/lib/swiftmailer/swift_required.php');
|
require_once(INCLUDE_DIR . '/lib/swiftmailer/swift_required.php');
|
||||||
|
|
||||||
// Detect device
|
// Detect device
|
||||||
if ( PHP_SAPI == 'cli') {
|
require_once(INCLUDE_DIR . '/lib/Mobile_Detect.php');
|
||||||
|
$detect = new Mobile_Detect;
|
||||||
|
|
||||||
|
if (!$detect->isMobile()) {
|
||||||
|
$theme = $setting->getValue('website_mobile_theme', 'bootstrap');
|
||||||
|
} else if ( PHP_SAPI == 'cli') {
|
||||||
// Create a new compile folder just for crons
|
// Create a new compile folder just for crons
|
||||||
// We call mail templates directly anyway
|
// We call mail templates directly anyway
|
||||||
$theme = 'cron';
|
$theme = 'cron';
|
||||||
} else {
|
} else {
|
||||||
// Use configured theme, fallback to default theme
|
// Use configured theme, fallback to default theme
|
||||||
$setting->getValue('website_theme') ? $theme = $setting->getValue('website_theme') : $theme = 'bootstrap';
|
$theme = $setting->getValue('website_theme', 'bootstrap');
|
||||||
}
|
}
|
||||||
define('THEME', $theme);
|
define('THEME', $theme);
|
||||||
|
|
||||||
|
|||||||
@ -69,6 +69,13 @@ $aSettings['website'][] = array(
|
|||||||
'name' => 'website_theme', 'value' => $setting->getValue('website_theme'),
|
'name' => 'website_theme', 'value' => $setting->getValue('website_theme'),
|
||||||
'tooltip' => 'The default theme used on your pool.'
|
'tooltip' => 'The default theme used on your pool.'
|
||||||
);
|
);
|
||||||
|
$aSettings['website'][] = array(
|
||||||
|
'display' => 'Website mobile theme', 'type' => 'select',
|
||||||
|
'options' => $aThemes,
|
||||||
|
'default' => 'bootstrap',
|
||||||
|
'name' => 'website_mobile_theme', 'value' => $setting->getValue('website_mobile_theme'),
|
||||||
|
'tooltip' => 'The default theme used on your pool.'
|
||||||
|
);
|
||||||
$aSettings['website'][] = array(
|
$aSettings['website'][] = array(
|
||||||
'display' => 'Website Design', 'type' => 'select',
|
'display' => 'Website Design', 'type' => 'select',
|
||||||
'options' => $aDesigns,
|
'options' => $aDesigns,
|
||||||
|
|||||||
1248
include/lib/Mobile_Detect.php
Normal file
1248
include/lib/Mobile_Detect.php
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user