Browser::checkBrowserInternetExplorer PHP Méthode

checkBrowserInternetExplorer() protected méthode

Determine if the browser is Internet Explorer or not (last updated 1.7)
protected checkBrowserInternetExplorer ( ) : boolean
Résultat 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);
            $this->setVersion('11.0');
            return true;
        } else {
            if (stripos($this->_agent, 'microsoft internet explorer') !== false) {
                $this->setBrowser(self::BROWSER_IE);
                $this->setVersion('1.0');
                $aresult = stristr($this->_agent, '/');
                if (preg_match('/308|425|426|474|0b1/i', $aresult)) {
                    $this->setVersion('1.5');
                }
                return true;
            } else {
                if (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);
                            $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);
                        $this->setVersion(str_replace(array('(', ')', ';'), '', $aresult[1]));
                        if (stripos($this->_agent, 'IEMobile') !== false) {
                            $this->setBrowser(self::BROWSER_POCKET_IE);
                            $this->setMobile(true);
                        }
                        return true;
                    }
                } else {
                    if (stripos($this->_agent, 'trident') !== false) {
                        $this->setBrowser(self::BROWSER_IE);
                        $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);
                        }
                    } else {
                        if (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);
                                $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;
    }