Ejemplo n.º 1
0
 function Wall($ua = false)
 {
     global $_GET, $_SERVER;
     if (!$ua) {
         $this->ua = isset($_GET['UA']) ? $_GET['UA'] : getenv('HTTP_USER_AGENT');
     } else {
         $this->ua = $ua;
     }
     if (defined('WALL_USE_TERA_WURFL') && WALL_USE_TERA_WURFL) {
         switch (TERA_WURFL_VERSION) {
             case 1:
                 require_once WURFL_CLASS_FILE;
                 $this->wurfl = new tera_wurfl();
                 $this->wurfl->getDeviceCapabilitiesFromAgent($this->ua);
                 break;
             case 2:
                 // The class file was loaded in wall_prepend.php
                 $this->wurfl = new TeraWurfl();
                 if (!$ua) {
                     $this->ua = WurflSupport::getUserAgent();
                 }
                 $this->wurfl->getDeviceCapabilitiesFromAgent($this->ua);
                 break;
             case 'webservice':
                 $this->wurfl = new TeraWurflRemoteClient(TERA_WURFL_WEBSERVICE_URL, TeraWurflRemoteClient::$FORMAT_JSON);
                 if (!$ua) {
                     $this->ua = TeraWurflRemoteClient::getUserAgent();
                 }
                 $this->wurfl->getCapabilitiesFromAgent($this->ua, $GLOBALS['WALLWurflCapabilities']);
                 break;
         }
     } else {
         $this->wurfl = new wurfl_class();
         $this->wurfl->getDeviceCapabilitiesFromAgent($this->ua);
     }
     ob_start(array($this, '_obCallBack'));
     register_shutdown_function(array($this, '_obEndFlush'));
 }