Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

PHP Browser Detection for WordPress Suggested Code change

By: fancyfiber on Jan 26th, 2013  |  syntax: PHP  |  size: 1.06 KB  |  views: 36  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. // MOBILE / IPHONE / IPAD **********************************************************
  2.  
  3. function is_mobile (){
  4.         $browserInfo = php_browser_info();
  5.         if(isset($browserInfo['ismobiledevice']) && ($browserInfo['ismobiledevice']=='true' || $browserInfo['ismobiledevice']=='1') )
  6.                 return true;
  7.         return false;  
  8. }
  9.  
  10. //.....
  11.  
  12. // TEST FOR FEATURES ****************************************************
  13.  
  14. function browser_supports_javascript() {
  15.         $browserInfo = php_browser_info();
  16.         if(isset($browserInfo['javascript']) && ($browserInfo['javascript']=='1' || $browserInfo['javascript']=='true') )
  17.                 return true;
  18.         return false;          
  19. }
  20.  
  21. function browser_supports_cookies() {
  22.         $browserInfo = php_browser_info();
  23.         if(isset($browserInfo['cookies']) && ($browserInfo['cookies']=='1' || $browserInfo['cookies']=='true'))
  24.                 return true;
  25.         return false;          
  26. }
  27.  
  28. function browser_supports_css() {
  29.         $browserInfo = php_browser_info();
  30.         if(isset($browserInfo['supportscss']) && ($browserInfo['supportscss']=='1' || $browserInfo['supportscss']=='true') )
  31.                 return true;
  32.         return false;          
  33. }