The UserAgent Storage Interface | Zend_Http Programmer's Reference Guide | Zend_InfoCard

# The Session UserAgent Storage Adapter

# Overview

This storage adapter utilizes Zend_Session_Namespace for persisting discovered device capabilities for a given user session.

# Quick Start

This particular storage adapter is used by default with Zend_Http_UserAgent. As such, you will benefit from it from the outset without any real configuration necessary.

You can alter the behavior slightly, however, by altering the namespace used, and the key (or member) in which data is written. You may do so by specifying the browser_type (mapped to namespace) and member options in your configuration.

1. resources.useragent.storage.adapter = "Session"
2. resources.useragent.storage.options.browser_type = "all"
3. resources.useragent.storage.options.member = "data"

Typically, you will not pass the browser_type option, and instead let this be populated by the value discovered by the UserAgent class.

# Configuration Options

# Session Storage Options

browser_type

  Provide this in order to hardcode the session namespace in which you wish to store the User-Agent data. By default, the currently discovered browser type will be used, or, if not provided, the value "Zend_Http_UserAgent".

member

  This is the specific variable member within the session namespace in which the data will be stored. By default, the value "storage" will be used.

# Available Methods

__construct ( $options = null )

  Accepts an array or object containing options. See the configuration options section for details on the $options variable.

isEmpty

  Used to determine whether or not the storage has been populated yet.

read

  Retrieve previously stored data from the storage adapter.

write ( $contents )

  Write data to the storage adapter for later retrieval. $contents should be a string containing the serialized UserAgent object.

clear

  Clear the storage of any data.

The UserAgent Storage Interface | Zend_Http Programmer's Reference Guide | Zend_InfoCard