<p style="font-size: 42px;"><strong>You are a robot!</strong></p> <?php } ?> <p>You are on a <?php echo nebula_get_device('type'); ?> which is a <?php echo nebula_get_device('formfactor'); ?> device. That means it <strong><?php echo nebula_is_desktop() ? 'is' : 'is not'; ?> </strong> a desktop device, it <strong><?php echo nebula_is_tablet() ? 'is' : 'is not'; ?> </strong> a tablet device, and it <strong><?php echo nebula_is_mobile() ? 'is' : 'is not'; ?> </strong> a mobile device.</p> <?php if (nebula_get_device('model') != '') { ?> <p>The device itself is a <strong><?php echo nebula_get_device('full'); ?> </strong>.</p> <?php }
function nebula_get_device($info = 'model') { $override = apply_filters('pre_nebula_get_device', false, $info); if ($override !== false) { return $override; } $info = str_replace(' ', '', $info); switch (strtolower($info)) { case 'full': return $GLOBALS["device_detect"]->getBrandName() . ' ' . $GLOBALS["device_detect"]->getModel(); break; case 'brand': case 'brandname': case 'make': return $GLOBALS["device_detect"]->getBrandName(); break; case 'model': case 'version': case 'name': return $GLOBALS["device_detect"]->getModel(); break; case 'type': return $GLOBALS["device_detect"]->getDeviceName(); break; case 'formfactor': if (nebula_is_mobile()) { return 'mobile'; } elseif (nebula_is_tablet()) { return 'tablet'; } else { return 'desktop'; } default: return false; break; } }