January 25, 2022, 02:51:15 PM

News:

Want to get involved in developing SMF, then why not lend a hand on our github!


Additional Info
Type
Package ID
emanuele:mobiledevicedetect
First Created
February 12, 2012, 06:13:50 PM
Last Updated
April 11, 2012, 05:45:36 AM

Mobile Device Detect v0.2.2

Detection of several mobile devices and setting of a special theme
Compatible With 2.0.2
Latest version v0.2.2
Downloads 7,426
Reviews 0
Rating 0/5
Subscribers 46
License (View License)
Author(s)
A small mod that uses the code from the MobileESP Project in order to detect if the user visiting your forum is using a mobile device or not.

At the moment in this mod this function is used to allow admins to select a default theme for mobile devices.
Going to Admin > Configuration > Themes and Layout > Manage and Install a new dropdown is present where you will be able to select a theme for users with mobile devices.

Note: since the normal detection code would probably be too cumbersome for just define if a user is using a mobile device of not, I'm using a modified (untested in real world) version of the code and for that reason the detection could be not "perfect". Your feedback is highly appreciated!

The complete list of devices is too long to write here and now, look at the code. :P
A short list includes: iPhone, iPad, iPod, Android-based, Symbian OS-based, windows 7 and ce based, blackberry and others.

Once instantiated the class is placed in $context['device'], so that other mods and themes can use the it in order to do change their behaviour depending on the device.

Feel free to fork and help at https://github.com/emanuele45/Mobile-Device-Detect

Change log
  • 0.1.0: initial release
  • 0.2.0: the theme is set based on the function CheckIsMobile (provided by feline and just changed a bit), fixed an undefined index error, few other things. The code from Mobile EPS is still the re if anyone wants to use it.
  • 0.2.1: removed the __contruct function from the class to avoid php errors (Redefining already defined constructor)
  • 0.2.2: removed "tablet" because too generic; added word boundary to the regexp (thanks feline)
Manual installation info
You have to register or login to be able to leave a review
There are currently no reviews on this customization
Advertisement: