Esempio n. 1
0
File: p4a.php Progetto: eliudiaz/p4a
 /**
  * @return array
  */
 private function detectClient()
 {
     require_once dirname(dirname(__FILE__)) . '/libraries/pear_net_useragent_detect.php';
     Net_UserAgent_Detect::detect();
     if (P4A_FORCE_HANDHELD_RENDERING) {
         $this->browser = self::BROWSER_HANDHELD;
     } elseif (Net_UserAgent_Detect::isIE()) {
         $this->browser = self::BROWSER_IE;
     } elseif (Net_UserAgent_Detect::isBrowser('gecko')) {
         $this->browser = self::BROWSER_GECKO;
     } elseif (Net_UserAgent_Detect::isBrowser('safari')) {
         $this->browser = self::BROWSER_SAFARI;
     } elseif (Net_UserAgent_Detect::isBrowser('opera')) {
         $this->browser = self::BROWSER_OPERA;
     } else {
         $this->browser = self::BROWSER_HANDHELD;
     }
     foreach (Net_UserAgent_Detect::_getStaticProperty('os') as $os => $detected) {
         if ($detected) {
             if (preg_match("/^win.*\$/", $os)) {
                 $this->browser_os = self::BROWSER_WINDOWS;
             } elseif (preg_match("/^mac.*\$/", $os)) {
                 $this->browser_os = self::BROWSER_MAC;
             }
             break;
         }
     }
     return Net_UserAgent_Detect::_getStaticProperty('browser');
 }