Вход Регистрация
Файл: adultscript-2.0.3-pro/files/libraries/framework/device.php
Строк: 18
<?php
class VDevice
{
    private 
$cache = array();
    private 
$detect;
    public function 
__construct()
    {
        
VF::load('mobiledetect.Mobile_Detect');
        
$this->detect = new Mobile_Detect;
        
        
$this->cache['isMobile']        = $this->detect->isMobile();
        
$this->cache['isTablet']        = $this->detect->isTablet();
        
$this->cache['isiOS']            = $this->detect->isiOS();
        
$this->cache['redirectEnabled']    = VF::cfg_item('module.mobile.redirect');
        
$this->cache['mobileEnabled']    = (VModule::enabled('mobile')) ? true false;
        
$this->cache['mobileUrl']        = VF::cfg_item('mobile_url');
    }
    
    public function 
isMobile()
    {
        return 
$this->cache['isMobile'];
    }
    
    public function 
isiOS()
    {
        return 
$this->cache['isiOS'];
    }
    
    public function 
redirect($url)
    {
        if (
$this->cache['isMobile'] &&
            
$this->cache['mobileEnabled'] &&
            
$this->cache['redirectEnabled']) {
            
VF::redirect($this->cache['mobileUrl'].$url302);
        }
    }
}
Онлайн: 0
Реклама