diff -r bd595ad770fc -r 1c2f13fd785c web/enmi/Zend/Http/UserAgent/Mobile.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/enmi/Zend/Http/UserAgent/Mobile.php Thu Jan 20 19:30:54 2011 +0100 @@ -0,0 +1,534 @@ +setFeature('is_wireless_device', false, 'product_info'); + + parent::_defineFeatures(); + + if (isset($this->_aFeatures["mobile_browser"])) { + $this->setFeature("browser_name", $this->_aFeatures["mobile_browser"]); + $this->_browser = $this->_aFeatures["mobile_browser"]; + } + if (isset($this->_aFeatures["mobile_browser_version"])) { + $this->setFeature("browser_version", $this->_aFeatures["mobile_browser_version"]); + $this->_browserVersion = $this->_aFeatures["mobile_browser_version"]; + } + + // markup + if ($this->getFeature('device_os') == 'iPhone OS' + || $this->getFeature('device_os_token') == 'iPhone OS' + ) { + $this->setFeature('markup', 'iphone'); + } else { + $this->setFeature('markup', $this->getMarkupLanguage($this->getFeature('preferred_markup'))); + } + + // image format + $this->_images = array(); + + if ($this->getFeature('png')) { + $this->_images[] = 'png'; + } + if ($this->getFeature('jpg')) { + $this->_images[] = 'jpg'; + } + if ($this->getFeature('gif')) { + $this->_images[] = 'gif'; + } + if ($this->getFeature('wbmp')) { + $this->_images[] = 'wbmp'; + } + + return $this->_aFeatures; + } + + /** + * Determine markup language expected + * + * @access public + * @return __TYPE__ + */ + public function getMarkupLanguage($preferredMarkup = null) + { + $return = ''; + switch ($preferredMarkup) { + case 'wml_1_1': + case 'wml_1_2': + case 'wml_1_3': + $return = 'wml'; //text/vnd.wap.wml encoding="ISO-8859-15" + case 'html_wi_imode_compact_generic': + case 'html_wi_imode_html_1': + case 'html_wi_imode_html_2': + case 'html_wi_imode_html_3': + case 'html_wi_imode_html_4': + case 'html_wi_imode_html_5': + $return = 'chtml'; //text/html + case 'html_wi_oma_xhtmlmp_1_0': //application/vnd.wap.xhtml+xml + case 'html_wi_w3_xhtmlbasic': //application/xhtml+xml DTD XHTML Basic 1.0 + $return = 'xhtml'; + case 'html_web_3_2': //text/html DTD Html 3.2 Final + case 'html_web_4_0': //text/html DTD Html 4.01 Transitional + $return = ''; + } + return $return; + } + + /** + * Determine image format support + * + * @return array + */ + public function getImageFormatSupport() + { + return $this->_images; + } + + /** + * Determine maximum image height supported + * + * @return int + */ + public function getMaxImageHeight() + { + return $this->getFeature('max_image_height'); + } + + /** + * Determine maximum image width supported + * + * @return int + */ + public function getMaxImageWidth() + { + return $this->getFeature('max_image_width'); + } + + /** + * Determine physical screen height + * + * @return int + */ + public function getPhysicalScreenHeight() + { + return $this->getFeature('physical_screen_height'); + } + + /** + * Determine physical screen width + * + * @return int + */ + public function getPhysicalScreenWidth() + { + return $this->getFeature('physical_screen_width'); + } + + /** + * Determine preferred markup + * + * @return string + */ + public function getPreferredMarkup() + { + return $this->getFeature("markup"); + } + + /** + * Determine X/HTML support level + * + * @return int + */ + public function getXhtmlSupportLevel() + { + return $this->getFeature('xhtml_support_level'); + } + + /** + * Does the device support Flash? + * + * @return bool + */ + public function hasFlashSupport() + { + return $this->getFeature('fl_browser'); + } + + /** + * Does the device support PDF? + * + * @return bool + */ + public function hasPdfSupport() + { + return $this->getFeature('pdf_support'); + } + + /** + * Does the device have an associated phone number? + * + * @return bool + */ + public function hasPhoneNumber() + { + return $this->getFeature('can_assign_phone_number'); + } + + /** + * Does the device support HTTPS? + * + * @return bool + */ + public function httpsSupport() + { + return ($this->getFeature('https_support') == 'supported'); + } +}