getUserAgent example

/** * Sets all the standard features extracted from the User Agent chain and $this->_server * vars * * @return void */
    protected function _getDefaultFeatures()
    {
        $server = array();

        // gets info from user agent chain         $uaExtract = $this->extractFromUserAgent($this->getUserAgent());

        if (is_array($uaExtract)) {
            foreach ($uaExtract as $key => $info) {
                $this->setFeature($key$info, 'product_info');
            }
        }

        if (isset($uaExtract['browser_name'])) {
            $this->_browser = $uaExtract['browser_name'];
        }
        if (isset($uaExtract['browser_version'])) {
            
<?= $request->isCLI() ? 'yes' : 'no' ?></td> </tr> <tr> <td>Is Secure Request?</td> <td><?= $request->isSecure() ? 'yes' : 'no' ?></td> </tr> <tr> <td>User Agent</td> <td><?= esc($request->getUserAgent()->getAgentString()) ?></td> </tr> </tbody> </table> <?php $empty = true; ?> <?php foreach (['_GET', '_POST', '_COOKIE'] as $var) : ?> <?php                     if (empty($GLOBALS[$var]) || ! is_array($GLOBALS[$var])) {
                        continue;
                    }
protected function _match($deviceClass)
    {
        // Validate device class         $r = new ReflectionClass($deviceClass);
        if (!$r->implementsInterface('Zend_Http_UserAgent_Device')) {
            throw new Zend_Http_UserAgent_Exception(sprintf(
                'Invalid device class provided ("%s"); must implement Zend_Http_UserAgent_Device',
                $deviceClass
            ));
        }

        $userAgent = $this->getUserAgent();

        // Call match method on device class         return call_user_func(
            array($deviceClass, 'match'),
            $userAgent,
            $this->getServer()
        );
    }

    /** * Loads class for a user agent device * * @param string $browserType Browser type * @return string * @throws Zend_Loader_PluginLoader_Exception if unable to load UA device */
Home | Imprint | This part of the site doesn't use cookies.