From 4fbd142ed7ce8fc086905fea43707b70d3c6a1c5 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Tue, 19 Feb 2013 17:24:01 +0100 Subject: [PATCH] Adding BrowserString view helper. --- library/Fiktiv/View/Helper/BrowserString.php | 56 ++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 library/Fiktiv/View/Helper/BrowserString.php diff --git a/library/Fiktiv/View/Helper/BrowserString.php b/library/Fiktiv/View/Helper/BrowserString.php new file mode 100644 index 0000000..db5ef95 --- /dev/null +++ b/library/Fiktiv/View/Helper/BrowserString.php @@ -0,0 +1,56 @@ +getDevice()->getBrowserVersion()); + return implode('.', array_slice($parts, 0, 2)); + } + + /** + * Constructor + * + * Constructs and stores the browser string to + * later be retrieved by the helper method. + * + * @return void + */ + public function __construct() + { + // Construct the string. + $httpAgent = new Zend_Http_UserAgent(); + + $this->_info = $httpAgent->getDevice()->getBrowser() . " " + . $this->_getVersion($httpAgent); + } + + /** + * The Actual helper method. + * + * @return string + */ + public function browserString() + { + return $this->_info; + } +}