當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Mobile_Detect::mobileGrade方法代碼示例

本文整理匯總了PHP中Mobile_Detect::mobileGrade方法的典型用法代碼示例。如果您正苦於以下問題:PHP Mobile_Detect::mobileGrade方法的具體用法?PHP Mobile_Detect::mobileGrade怎麽用?PHP Mobile_Detect::mobileGrade使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Mobile_Detect的用法示例。


在下文中一共展示了Mobile_Detect::mobileGrade方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1:

<?php

/**
 * =============== CACTUSTHEMES.COM ===================
 * ======== Cactusthemes Skeleton Framework ===========
 *          version 0.1 - created 29/4/2013
 * ====================================================
 */
require_once 'utility-functions.php';
require_once locate_template('/inc/mobile-detect.php');
$detect = new Mobile_Detect();
global $_device_, $_device_name_, $_is_retina_;
$_device_ = $detect->isMobile() ? $detect->isTablet() ? 'tablet' : 'mobile' : 'pc';
$_device_name_ = $detect->mobileGrade();
$_is_retina_ = $detect->isRetina();
/**
 * Option Tree integration ===========
 */
/**
 * Optional: set 'ot_show_pages' filter to false.
 * This will hide the settings & documentation pages.
 */
add_filter('ot_show_pages', '__return_true');
/**
 * Optional: set 'ot_show_new_layout' filter to false.
 * This will hide the "New Layout" section on the Theme Options page.
 */
add_filter('ot_show_new_layout', '__return_false');
/**
 * Required: set 'ot_theme_mode' filter to true.
 */
開發者ID:hamednourhani,項目名稱:naiau.ir,代碼行數:31,代碼來源:skeleton-core.php

示例2: ac_get_device_classes

/**** Alleycat Mobile Detect ****/
/********************************/
// Detect whether this is a mobile device, etc and store global variables for use later within PHP
// Include the script
require_once 'Mobile_Detect.php';
// Setup
$detect = new Mobile_Detect();
// Use global variables to allow other parts of PHP to access the values.  This avoids the use of sessions
global $ac_is_mobile;
global $ac_is_tablet;
global $ac_mobile_grade;
global $ac_touch_device;
// Get the values from the object
$ac_is_mobile = $detect->isMobile();
$ac_is_tablet = $detect->isTablet();
$ac_mobile_grade = $detect->mobileGrade();
$ac_touch_device = $ac_is_mobile || $ac_is_tablet;
// Returns css classes based on device
function ac_get_device_classes()
{
    global $ac_is_mobile, $ac_is_tablet, $ac_touch_device;
    $return = '';
    if ($ac_is_mobile) {
        $return .= ' ac-mobile ';
    }
    if ($ac_is_tablet) {
        $return .= ' ac-tablet ';
    }
    if ($ac_touch_device) {
        $return .= ' ac-touch-device ';
    }
開發者ID:Jhorton4,項目名稱:Bohldfeys_Portfolio,代碼行數:31,代碼來源:ac-mobile-detect.php

示例3: function

<?php

// Adds device information into timber context
add_filter('timber_context', function ($context) {
    $detect = new Mobile_Detect();
    $context['device'] = array('isMobile' => $detect->isMobile(), 'isTablet' => $detect->isTablet(), 'isPhone' => $detect->isMobile() && !$detect->isTablet(), 'mobileGrade' => $detect->mobileGrade());
    return $context;
});
開發者ID:Adelinegen,項目名稱:wp-boilerplate,代碼行數:8,代碼來源:mobile-detect.php


注:本文中的Mobile_Detect::mobileGrade方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。