承接 wpbones/useragent 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

wpbones/useragent

Composer 安装命令:

composer require wpbones/useragent

包简介

An useful method to detect the useragent

README 文档

README

Latest Stable Version   Latest Unstable Version   Total Downloads   License   Monthly Downloads

An useful wrapper for Mobile Detect to detect mobile devices for WP Bones.

Requirements

This package works with a WordPress plugin written with WP Bones framework library.

Installation

You can install third party packages by using:

php bones require wpbones/useragent

I advise to use this command instead of composer require because doing this an automatic renaming will done.

You can use composer to install this package:

composer require wpbones/useragent

You may also to add "wpbones/useragent": "^1.0" in the composer.json file of your plugin:

  "require": {
    "php": ">=7.4",
    "wpbones/wpbones": "~0.8",
    "wpbones/useragent": "~1.0"
  },

and run

composer install

How to

You will be able to use wpbones_user_agent() function to get an instance of Mobile Detect.

if(wpbones_user_agent()->isMobile()) {
  echo "You're by Mobile";
} else {
  echo "You're by Desktop";
}

Sample

// Basic detection.
wpbones_user_agent()->isMobile();
wpbones_user_agent()->isTablet();

// Magic methods.
wpbones_user_agent()->isIphone();
wpbones_user_agent()->isSamsung();
// [...]

// Alternative to magic methods.
wpbones_user_agent()->is('iphone');

// Find the version of component.
wpbones_user_agent()->version('Android');

You may also

// Any mobile device (phones or tablets).
if ( wpbones_user_agent()->isMobile() ) {

}

// Any tablet device.
if( wpbones_user_agent()->isTablet() ){

}

// Exclude tablets.
if( wpbones_user_agent()->isMobile() && !wpbones_user_agent()->isTablet() ){

}

// Check for a specific platform with the help of the magic methods:
if( wpbones_user_agent()->isiOS() ){

}

if( wpbones_user_agent()->isAndroidOS() ){

}

// Alternative method is() for checking specific properties.
// WARNING: this method is in BETA, some keyword properties will change in the future.
wpbones_user_agent()->is('Chrome')
wpbones_user_agent()->is('iOS')
wpbones_user_agent()->is('UCBrowser')
wpbones_user_agent()->is('Opera')
// [...]

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-01-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固