Show
Ignore:
Timestamp:
2008-06-25 09:17:42 (7 months ago)
Author:
th-schwarz
Message:

- solved ticked #2295
- cleaned up compatibility code

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/tool/Compatibility.java

    r2101 r2133  
    3535        /** 
    3636         * Checks if a browser's user agent string is compatible for the FCKeditor. 
    37          * <br /> 
    38          * Adapted from: 
    39          * http://dev.fckeditor.net/browser/FCKeditor/releases/stable/fckeditor.php 
    4037         *  
    41          * @param userAgentString 
     38         * @param userAgentStr 
    4239         * @return <code>true</code> if compatible otherwise <code>false</code> 
    4340         */ 
     
    4542                if (Utils.isEmpty(userAgentString)) 
    4643                        return false; 
    47  
    48                 float version; 
     44                 
     45                String userAgentStr = userAgentString.toLowerCase(); 
    4946 
    5047                // IE 5.5+, check special keys like 'Opera' and 'mac', because there are some 
    5148                // other browsers, containing 'MSIE' in there agent string! 
    52                 if (userAgentString.indexOf("Opera") < 0 && userAgentString.indexOf("mac") < 0) { 
    53                         version = getBrowserVersion(userAgentString, ".*MSIE ([\\d]+.[\\d]+).*"); 
    54                         if (version != -1f && version >= 5.5f) 
     49                if (userAgentStr.indexOf("opera") < 0 && userAgentStr.indexOf("mac") < 0) { 
     50                        if (getBrowserVersion(userAgentStr, ".*msie ([\\d]+.[\\d]+).*") >= 5.5f) 
    5551                                return true; 
    5652                } 
    57  
    58                 // for mozilla only, because all firefox versions are supported 
    59                 version = getBrowserVersion(userAgentString, ".*Gecko/([\\d]+).*"); 
    60                 if (version != -1f && version >= 20030210f) 
     53                 
     54                // for all gecko based browsers 
     55                if (getBrowserVersion(userAgentStr, ".*rv:([\\d]+.[\\d]+).*") > 1.7f) 
    6156                        return true; 
    62  
     57                 
    6358                // Opera 9.5+ 
    64                 version = getBrowserVersion(userAgentString, "Opera/([\\d]+.[\\d]+).*"); 
    65                 if (version != -1f && version >= 9.5f) 
    66                         return true; 
    67                 version = getBrowserVersion(userAgentString, ".*Opera ([\\d]+.[\\d]+)"); 
    68                 if (version != -1f && version >= 9.5f) 
     59                if (getBrowserVersion(userAgentStr, "opera/([\\d]+.[\\d]+).*") >= 9.5f 
     60                                || getBrowserVersion(userAgentStr, ".*opera ([\\d]+.[\\d]+)") >= 9.5f) 
    6961                        return true; 
    7062 
    7163                // Safari 3+ 
    72                 version = getBrowserVersion(userAgentString, ".*AppleWebKit/([\\d]+).*"); 
    73                 if (version != -1f && version >= 522f) 
     64                if (getBrowserVersion(userAgentStr, ".*applewebkit/([\\d]+).*") >= 522f) 
    7465                        return true; 
    7566