public static function check_gecko_version($version = null) {
        // Gecko based browsers.
        // Do not look for dates any more, we expect real Firefox version here.
        $useragent = self::get_user_agent_string();
        if ($useragent === false) {
            return false;
        }
        if (empty($version)) {
            $version = 1;
        } else if ($version > 20000000) {
            // This is just a guess, it is not supposed to be 100% accurate!
            if (preg_match('/^201/', $version)) {
                $version = 3.6;
            } else if (preg_match('/^200[7-9]/', $version)) {
                $version = 3;
            } else if (preg_match('/^2006/', $version)) {
                $version = 2;
            } else {
                $version = 1.5;
            }
        }
        if (preg_match("/(Iceweasel|Firefox)\/([0-9\.]+)/i", $useragent, $match)) {
            // Use real Firefox version if specified in user agent string.
            if (version_compare($match[2], $version) >= 0) {
                return true;
            }
        } else if (preg_match("/Gecko\/([0-9\.]+)/i", $useragent, $match)) {
            // Gecko might contain date or Firefox revision, let's just guess the Firefox version from the date.
            $browserver = $match[1];
            if ($browserver > 20000000) {
                // This is just a guess, it is not supposed to be 100% accurate!
                if (preg_match('/^201/', $browserver)) {
                    $browserver = 3.6;
                } else if (preg_match('/^200[7-9]/', $browserver)) {
                    $browserver = 3;
                } else if (preg_match('/^2006/', $version)) {
                    $browserver = 2;
                } else {
                    $browserver = 1.5;
                }
            }
            if (version_compare($browserver, $version) >= 0) {
                return true;
            }
        }
        return false;
    }