| Server IP : 104.21.25.182 / Your IP : 216.73.216.203 Web Server : Apache System : Linux server.rehabsharif.com 5.14.0-611.54.3.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:31:24 EDT 2026 x86_64 User : nobi37te ( 1003) PHP Version : 8.2.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/nobi37te/public_html/wp-content/plugins/nitropack/nitropack-sdk/NitroPack/SDK/ |
Upload File : |
<?php
namespace NitroPack\SDK;
class Device {
private $userAgent;
public static function getKnownTypes() {
return array(DeviceType::MOBILE, DeviceType::TABLET, DeviceType::DESKTOP);
}
public function __construct($userAgent = "") {
$this->userAgent = $userAgent;
}
public function getUserAgent() {
return $this->userAgent;
}
public function isDesktop() {
return !($this->isMobile() && $this->isTablet());
}
public function isMobile() {
if (empty($this->userAgent)) return false;
$mobile_agents = array('iPod','iPhone','MobileSafari','webOS','BlackBerry','windows phone','symbian','vodafone','opera mini','windows ce','smartphone','palm','midp');
foreach($mobile_agents as $mobile_agent){
if(stripos($this->userAgent, $mobile_agent)) {
return true;
}
}
if(stripos($this->userAgent, "Android") && stripos($this->userAgent, "mobile")) {
return true;
}
return false;
}
public function isTablet() {
if (empty($this->userAgent)) return false;
$tablet_agents = array('iPad','RIM Tablet','hp-tablet','Kindle Fire','Android');
foreach($tablet_agents as $tablet_agent){
if(stripos($this->userAgent, $tablet_agent)) {
return true;
}
}
if(stripos($this->userAgent, "Android") && stripos($this->userAgent, "mobile")) {
return true;
}
return false;
}
public function getType() {
if ($this->isMobile()) return DeviceType::MOBILE;
if ($this->isTablet()) return DeviceType::TABLET;
return DeviceType::DESKTOP;
}
}