定制 superbig/craft3-mobiledetect 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

superbig/craft3-mobiledetect

最新稳定版本:2.0.0

Composer 安装命令:

composer require superbig/craft3-mobiledetect

包简介

Use Mobile_Detect for detecting mobile devices (including tablets)

README 文档

README

Use Mobile_Detect for detecting mobile devices (including tablets)

Screenshot

Requirements

This plugin requires Craft CMS 3.0.0-beta.23 or later.

Installation

To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:

     cd /path/to/project
    
  2. Then tell Composer to load the plugin:

     composer require superbig/craft3-mobiledetect
    
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for MobileDetect.

MobileDetect Overview

fairly complete wrapper for the Mobile_Detect library by @serbanghita.**

Using MobileDetect

The plugin exposes most of Mobile_Detect's methods, and can be used in your Twig:

{{ craft.mobileDetect.isMobile ? 'I am mobile.' : 'I am not mobile.' }}

...or as a PHP service:

<?php
$isMobile = MobileDetect::$plugin->mobileDetect->isMobile();

Methods/usage

Device detection

isMobile

Detects all mobile devices, both phones and tablets

isTablet
isPhone

Mobile OS detection

isiOS
isAndroidOS
isBlackBerryOS
isPalmOS
isSymbianOS
isWindowsMobileOS
isWindowsPhoneOS

Other methods

is(key)

Test for anything, e.g. is('iphone')

match(pattern)

Test using regular expressions

version(component)

Get the version of a component, e.g. version('iPhone')

mobileGrade

Get browser grade (e.g. "A")

getScriptVersion

Prints the MobileDetect library's version

getUserAgent
setUserAgent(userAgent)
getMobileHeaders
getHttpHeaders
setHttpHeaders(httpHeaders)
getCfHeaders
setCfHeaders(cfHeaders)

Brought to you by Superbig

统计信息

  • 总下载量: 53.04k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 19
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 19
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-11-05