Skip to content

Instantly share code, notes, and snippets.

@nclundsten
Created June 12, 2014 22:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nclundsten/7bce6e61f5bd058d5e93 to your computer and use it in GitHub Desktop.
Save nclundsten/7bce6e61f5bd058d5e93 to your computer and use it in GitHub Desktop.
public function getMobileDeviceType()
{
//get the detector
$detect = new \Detection\MobileDetect();
$type = false;
if ($detect->isMobile()) {
$type = "phone";
if ($detect->isTablet()) {
$type = "tablet";
}
}
//return phone
return $type;
}
public function getConfig()
{
$config = array();
$configFiles = array();
if ($this->getMobileDeviceType() == 'phone') {
$configFiles[] = __DIR__ . '/config/all.config.php';
$configFiles[] = __DIR__ . '/config/phone.config.php';
}
if ($this->getMobileDeviceType() == 'tablet') {
$configFiles[] = __DIR__ . '/config/all.config.php';
$configFiles[] = __DIR__ . '/config/tablet.config.php';
}
foreach($configFiles as $configFile) {
$config = \Zend\Stdlib\ArrayUtils::merge($config, include $configFile);
}
return $config;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment