Ejemplo n.º 1
0
 /**
  * Logs the Mobile Device in the log_visit table
  */
 public function logMobileInfo($notification)
 {
     if (self::trackerGetSetting('TeraWurflMode') == "disabled") {
         return;
     }
     //error_log("Piwik error with plugin: MobileAnalytics: Tera-WURFL settings are not correct, mobile devices will not be tracked until Tera-WURFL can be contacted.");
     $visitorInfo =& $notification->getNotificationObject();
     try {
         $this->initTeraWurfl();
         if ($this->wurflObj->getDeviceCapability('is_wireless_device')) {
             if ($this->wurflObj->getDeviceCapability('full_flash_support')) {
                 $flash = "Flash Player";
             } elseif (preg_match('/^(\\d)/', $this->wurflObj->getDeviceCapability('flash_lite_version'), $matches)) {
                 $flash = "Flash Lite " . $matches[1];
             } else {
                 $flash = "None";
             }
             $visitorInfo['mobile'] = 1;
             $visitorInfo['mobile_id'] = $this->wurflObj->capabilities['id'];
             $visitorInfo['mobile_brand'] = trim($this->wurflObj->getDeviceCapability('brand_name'));
             $visitorInfo['mobile_model'] = trim($visitorInfo['mobile_brand'] . ' ' . $this->wurflObj->getDeviceCapability('model_name'));
             $visitorInfo['mobile_browser'] = trim($this->wurflObj->getDeviceCapability('mobile_browser'));
             $visitorInfo['mobile_resolution'] = $this->wurflObj->getDeviceCapability('resolution_width') . 'x' . $this->wurflObj->getDeviceCapability('resolution_height');
             $visitorInfo['mobile_js'] = $this->wurflObj->getDeviceCapability('ajax_support_javascript') ? 1 : 0;
             $visitorInfo['mobile_flash'] = $flash;
             $visitorInfo['mobile_os'] = trim($this->wurflObj->getDeviceCapability('device_os'));
             $visitorInfo['mobile_ajax'] = $this->wurflObj->getDeviceCapability('ajax_xhr_type') != 'none' ? 1 : 0;
         } else {
             $visitorInfo['mobile'] = 0;
             $visitorInfo['mobile_id'] = $this->wurflObj->capabilities['id'];
             $visitorInfo['mobile_brand'] = null;
             $visitorInfo['mobile_model'] = null;
             $visitorInfo['mobile_browser'] = null;
             $visitorInfo['mobile_resolution'] = null;
             $visitorInfo['mobile_js'] = null;
             $visitorInfo['mobile_flash'] = null;
             $visitorInfo['mobile_os'] = null;
             $visitorInfo['mobile_ajax'] = null;
         }
     } catch (Exception $e) {
         error_log($e->getMessage());
     }
 }