2017 © Pedro Peláez
 

contao-module mobiledetection

Contao helper class for detecting mobile phones and tablets (device type). A Hook adds a CSS class in the body tag.

image

bugbuster/mobiledetection

Contao helper class for detecting mobile phones and tablets (device type). A Hook adds a CSS class in the body tag.

  • Tuesday, October 28, 2014
  • by BugBuster
  • Repository
  • 3 Watchers
  • 2 Stars
  • 124 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 7 Versions
  • 2 % Grown

The README.md

Contao Module MobileDetection

Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

About

Contao 3 Module "Mobile-Detection", based on "http://mobiledetect.net/", (*2)

Helperclasses for developer. Demo frontend module is present., (*3)

Installation

Manually

Over Composer

  • Search for bugbuster/mobiledetection, version >= 3.5
  • composer loads additionally "mobiledetect/mobiledetectlib" version 2.*

Hooks help!

A Hook add a special class to page css class (in body tag):, (*4)

  • phone : mobile device, but no tablet
  • tablet : mobile device and a tablet
  • computer : no mobile device, no tablet

Examples

Galaxy S II (Phone), (*5)

  • <body id="top" class="android safari webkit sf4 mobile phone">

Motorola Xoom (Tablet), (*6)

  • <body id="top" class="android safari webkit sf3 mobile tablet">

Linux Mint PC (Computer), (*7)

  • <body id="top" class="unix firefox gecko fx18 computer">

Usage the Classes

You have two options:, (*8)

  • You're using the original class (Detection\MobileDetect).
  • You're using the wrapper class (MobileDetection\Mobile_Detection).

Mobile_Detect (original class)

ER2 version (without a namespace of the original class)

include '<path>/Mobile_Detect.php';

$detect = new Mobile_Detect();

Continue as described in the next section., (*9)

Composer version (with a namespace of the original class)

use Detection\MobileDetect;

$detect = new MobileDetect(); 

// Check for any mobile device.
if ($detect->isMobile())

// Check for any tablet.
if($detect->isTablet())

// Check for any mobile device, excluding tablets.
if ($detect->isMobile() && !$detect->isTablet())

For the full list of available methods check the directory examples., (*10)

Mobile_Detection (wrapper class)

$this->import('\MobileDetection\Mobile_Detection','Mobile_Detection');

// Check device type
echo $this->Mobile_Detection->getDeviceType(); // phone|tablet|computer

// Check for any mobile device.
if ($this->Mobile_Detection->isMobile())

// Check for any tablet.
if ($this->Mobile_Detection->isTablet())

// Check mobile grade
echo $this->Mobile_Detection->getMobileGrade(); // A|B|C

// Check mobile rules
$arrRules = $this->Mobile_Detection->getMobileRules(); 
// result e.g. array('SamsungTablet','AndroidOS','Safari')

See demo module "MobileDetectionDemo"., (*11)

The Versions

28/10 2014

dev-master

9999999-dev http://www.contao.glen-langer.de

Contao helper class for detecting mobile phones and tablets (device type). A Hook adds a CSS class in the body tag.

  Sources   Download

LGPL-3.0+

The Requires

 

contao mobile phone tablet detection

28/10 2014

3.5.0

3.5.0.0 http://www.contao.glen-langer.de

Contao helper class for detecting mobile phones and tablets (device type). A Hook adds a CSS class in the body tag.

  Sources   Download

LGPL-3.0+

The Requires

 

contao mobile phone tablet detection

16/06 2014

dev-dev

dev-dev http://www.contao.glen-langer.de

Contao helper class for detecting mobile phones and tablets (device type). A Hook adds a CSS class in the body tag.

  Sources   Download

LGPL-3.0+

The Requires

 

contao mobile phone tablet detection

16/06 2014

3.5.0-beta

3.5.0.0-beta http://www.contao.glen-langer.de

Contao helper class for detecting mobile phones and tablets (device type). A Hook adds a CSS class in the body tag.

  Sources   Download

LGPL-3.0+

The Requires

 

contao mobile phone tablet detection

15/06 2014

3.5.0-alpha

3.5.0.0-alpha http://www.contao.glen-langer.de

Contao helper class for detecting mobile phones and tablets (device type). A Hook adds a CSS class in the body tag.

  Sources   Download

LGPL-3.0+

The Requires

 

contao mobile phone tablet detection

08/12 2013

3.4.0

3.4.0.0 http://www.contao.glen-langer.de

Contao helper class for detecting mobile phones and tablets (device type). A Hook adds a CSS class in the body tag.

  Sources   Download

LGPL-3.0+

The Requires

 

contao mobile phone tablet detection

02/11 2013

3.3.2

3.3.2.0 http://www.contao.glen-langer.de

Contao helper class for detecting mobile phones and tablets (device type). A Hook adds a CSS class in the body tag.

  Sources   Download

LGPL-3.0+

The Requires

 

mobile phone tablet detection