NukeViet\Client\Browser::checkBrowserInternetExplorer PHP Метод

checkBrowserInternetExplorer() защищенный Метод

Determine if the browser is Internet Explorer or not (last updated 1.7)
protected checkBrowserInternetExplorer ( ) : boolean
Результат boolean True if the browser is Internet Explorer otherwise false
    protected function checkBrowserInternetExplorer()
    {
        //  Test for IE11
        if (stripos($this->_agent, 'Trident/7.0; rv:11.0') !== false) {
            $this->setBrowser(self::BROWSER_IE, self::BROWSER_IE_NAME);
            $this->setVersion('11.0');
            return true;
        } elseif (preg_match('/\\sEdge\\/([0-9]+)\\.([0-9]+)/', $this->_agent, $m)) {
            $this->setBrowser(self::BROWSER_EDGE, self::BROWSER_EDGE_NAME);
            $this->setVersion($m[1] . '.' . $m[2]);
            return true;
        } elseif (stripos($this->_agent, 'microsoft internet explorer') !== false) {
            $this->setBrowser(self::BROWSER_IE, self::BROWSER_IE_NAME);
            $this->setVersion('1.0');
            $aresult = stristr($this->_agent, '/');
            if (preg_match('/308|425|426|474|0b1/i', $aresult)) {
                $this->setVersion('1.5');
            }
            return true;
        } elseif (stripos($this->_agent, 'msie') !== false && stripos($this->_agent, 'opera') === false) {
            // See if the browser is the odd MSN Explorer
            if (stripos($this->_agent, 'msnb') !== false) {
                $aresult = explode(' ', stristr(str_replace(';', '; ', $this->_agent), 'MSN'));
                if (isset($aresult[1])) {
                    $this->setBrowser(self::BROWSER_MSN, self::BROWSER_MSN_NAME);
                    $this->setVersion(str_replace(array('(', ')', ';'), '', $aresult[1]));
                    return true;
                }
            }
            $aresult = explode(' ', stristr(str_replace(';', '; ', $this->_agent), 'msie'));
            if (isset($aresult[1])) {
                $this->setBrowser(self::BROWSER_IE, self::BROWSER_IE_NAME);
                $this->setVersion(str_replace(array('(', ')', ';'), '', $aresult[1]));
                if (stripos($this->_agent, 'IEMobile') !== false) {
                    $this->setBrowser(self::BROWSER_POCKET_IE, self::BROWSER_POCKET_IE_NAME);
                    $this->setMobile(true);
                }
                return true;
            }
        } elseif (stripos($this->_agent, 'trident') !== false) {
            $this->setBrowser(self::BROWSER_IE, self::BROWSER_IE_NAME);
            $result = explode('rv:', $this->_agent);
            if (isset($result[1])) {
                $this->setVersion(preg_replace('/[^0-9.]+/', '', $result[1]));
                $this->_agent = str_replace(array("Mozilla", "Gecko"), "MSIE", $this->_agent);
            }
        } elseif (stripos($this->_agent, 'mspie') !== false || stripos($this->_agent, 'pocket') !== false) {
            $aresult = explode(' ', stristr($this->_agent, 'mspie'));
            if (isset($aresult[1])) {
                $this->setPlatform(self::PLATFORM_WINDOWS_CE);
                $this->setBrowser(self::BROWSER_POCKET_IE, self::BROWSER_POCKET_IE_NAME);
                $this->setMobile(true);
                if (stripos($this->_agent, 'mspie') !== false) {
                    $this->setVersion($aresult[1]);
                } else {
                    $aversion = explode('/', $this->_agent);
                    if (isset($aversion[1])) {
                        $this->setVersion($aversion[1]);
                    }
                }
                return true;
            }
        }
        return false;
    }