コード例 #1
0
?>

		<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 
}
?>

		<p>The operating system on this device is <strong><?php 
コード例 #2
0
ファイル: nebula_functions.php プロジェクト: CloouCom/Nebula
 function nebula_sms_link($phone, $message = '')
 {
     if (nebula_is_mobile()) {
         $sep = nebula_is_os('ios') ? '?' : ';';
         //@TODO "Nebula" 0: Encode $message string here...?
         return '<a class="nebula-sms-link" href="sms:' . nebula_phone_format($phone, 'tel') . $sep . 'body=' . $message . '">' . nebula_phone_format($phone, 'human') . '</a>';
     } else {
         return nebula_phone_format($phone, 'human');
     }
 }
コード例 #3
0
function nebula_sms_link($phone, $message = '')
{
    $override = apply_filters('pre_nebula_sms_link', false, $phone, $message);
    if ($override !== false) {
        return $override;
    }
    if (nebula_is_mobile()) {
        $sep = nebula_is_os('ios') ? '?' : ';';
        //@TODO "Nebula" 0: Encode $message string here...?
        return '<a class="nebula-sms-link" href="sms:' . nebula_phone_format($phone, 'tel') . $sep . 'body=' . $message . '">' . nebula_phone_format($phone, 'human') . '</a>';
    } else {
        return nebula_phone_format($phone, 'human');
    }
}
コード例 #4
0
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;
    }
}