Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Attempts to ascertain user agent support for CSS-based gradients.
- *
- * @version 1.1
- * @param string $ua UA string to analyse. Defaults to the current User-Agent.
- * @return bool True if browser appears capable of supporting CSS gradients.
- */
- function gradient_support($ua = ''){
- $agent = empty($ua) ? $_SERVER['HTTP_USER_AGENT'] : (string) $ua;
- // Gecko 1.9.2
- if(preg_match("#(Firefox|Thunderbird|Fennec)\/([\w\.]+)#", $agent, $match)){
- switch($match[1]){
- case 'Firefox' : return(version_compare('3.6', $match[2]) < 1); break;
- case 'Thunderbird' : return(version_compare('3.1', $match[2]) < 1); break;
- case 'Fennec' : return(version_compare('1.0a1', $match[1]) < 1); break;
- }
- }
- // Chrome (Apparently supported in all builds)
- else if(preg_match("#Chrome\/#", $agent, $match))
- return true;
- // Safari 4.0
- else if(preg_match("#Safari\/#", $agent, $match) && preg_match("#Version\/([\w\.]+)#", $agent, $match))
- return(version_compare('4.0', $match[1]) < 1);
- // Internet Explorer 10.0
- else if(preg_match("#MSIE ([\w\.]+)#", $agent, $match))
- return(version_compare('10.0', $match[1]) < 1);
- // Presto 2.8+ (Opera 11.10)
- else if(preg_match("#Presto\/([\w\.]+)#", $agent, $match))
- return(version_compare('2.8', $match[1]) < 1);
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement