isMobile() AND !$this->isTablet()): return TRUE; else: return FALSE; endif; } /** * detect if mobile is tablet * @return boolean */ public function isTabletDevice(){ if($this->isGenericTablet() or $this->isBlackberrytablet() or $this->isIpad() or $this->isKindle() or $this->isSamsungTablet() or $this->isMotorolaTablet() or $this->isAsusTablet()): return true; else : return false; endif; } public static function instance(){ if (!isset(self::$instance)) { self::$instance = new mod_mobile(); } return self::$instance; } /** * class factory * @return \mod_mobile * */ public static function detect() { return new mod_mobile; } /** * adds a mobile class to the body */ public static function mobile_class(){ add_filter( 'body_class', array('mod_mobile','add_mobile_classes')); } public function add_mobile_class($classes){ $classes[] = 'mobile'; return $classes; } public function add_mobile_classes($class){ //detect if is mobile device if(mod_mobile::detect()->isMobile()) $class[] = 'mobile'; //mobile phone if(mod_mobile::detect()->isPhone()) $class[] = 'phone'; //is tabler if(mod_mobile::detect()->isTablet()) $class[] = 'tablet'; //is android if(mod_mobile::detect()->isAndroidOS()) $class[] = 'android'; //is iOS if(mod_mobile::detect()->isiOS()) $class[] = 'ios'; //return class return $class; } }