当前位置: 首页>>代码示例>>PHP>>正文


PHP Q_Request::isTablet方法代码示例

本文整理汇总了PHP中Q_Request::isTablet方法的典型用法代码示例。如果您正苦于以下问题:PHP Q_Request::isTablet方法的具体用法?PHP Q_Request::isTablet怎么用?PHP Q_Request::isTablet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Q_Request的用法示例。


在下文中一共展示了Q_Request::isTablet方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Users_device_post

function Users_device_post()
{
    $user = Users::loggedInUser(true);
    $token = isset($_REQUEST['token']) ? $_REQUEST['token'] : null;
    $platform = Q_Request::platform();
    $version = Q_Request::OSVersion();
    $formFactor = Q_Request::isMobile() ? 'mobile' : (Q_Request::isTablet() ? 'tablet' : null);
    $device = new Users_Device();
    $device->userId = $user->id;
    $device->deviceId = $token;
    $device->platform = $platform;
    $device->version = $version;
    $device->formFactor = $formFactor;
    $device->sessionId = Q_Session::id();
    $_SESSION['Users']['deviceId'] = $token;
    Q_Response::setSlot('data', !!$device->save(true));
    Q_Utils::sendToNode(array("Q/method" => "Users/device", "userId" => $user->id, "deviceId" => $token));
}
开发者ID:dmitriz,项目名称:Platform,代码行数:18,代码来源:post.php

示例2: layoutView

 /**
  * Get or set the layout view that should be used in the response
  * @method layoutView
  * @static
  * @param {string} $new_view optionally set the new view, or unset it by passing false
  * @return {string}
  */
 static function layoutView($new_view = null)
 {
     if (isset($new_view)) {
         return Q_Response::$layout_view = $new_view;
     }
     if (Q_Response::$layout_view) {
         return Q_Response::$layout_view;
     }
     $app = Q_Config::expect('Q', 'app');
     $layout_view = Q_Config::get('Q', 'response', 'layout', 'html', "{$app}/layout/html.php");
     $desktop_layout_view = Q_Config::get('Q', 'response', 'layout', 'desktop', false);
     if ($desktop_layout_view) {
         $layout_view = $desktop_layout_view;
     }
     if (Q_Request::isTablet()) {
         $tablet_layout_view = Q_Config::get('Q', 'response', 'layout', 'tablet', false);
         if ($tablet_layout_view) {
             $layout_view = $tablet_layout_view;
         }
     } else {
         if (Q_Request::isMobile()) {
             $mobile_layout_view = Q_Config::get('Q', 'response', 'layout', 'mobile', false);
             if ($mobile_layout_view) {
                 $layout_view = $mobile_layout_view;
             }
         }
     }
     return $layout_view;
 }
开发者ID:dmitriz,项目名称:Platform,代码行数:36,代码来源:Response.php

示例3: isMobile

 /**
  * Detects whether the request is coming from a mobile browser
  * @method isMobile
  * @static
  * @return {boolean}
  */
 static function isMobile()
 {
     static $result;
     if (isset($result)) {
         return $result;
     }
     /**
      * @event Q/request/isMobile {before}
      * @return {boolean}
      */
     $result = Q::event('Q/request/isMobile', array(), 'before');
     if (isset($result)) {
         return $result;
     }
     return Q_Request::isTouchscreen() and !Q_Request::isTablet();
 }
开发者ID:dmitriz,项目名称:Platform,代码行数:22,代码来源:Request.php


注:本文中的Q_Request::isTablet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。