2
0

Zend_Http_UserAgent-Storage.xml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.http.user-agent-storage">
  4. <title>The UserAgent Storage Interface</title>
  5. <sect2 id="zend.http.user-agent-storage.intro">
  6. <title>Overview</title>
  7. <para>
  8. Because discovering and identifying mobile device capabilities can involve a number of
  9. resources, it's often useful to identify the capabilities on the first visit, and cache
  10. it for subsequent visits.
  11. </para>
  12. <para>
  13. The <interfacename>Zend_Http_UserAgent_Storage</interfacename> interface provides a
  14. simple definition for defining storage adapters capable of persisting definitions. By
  15. default, a <classname>Session</classname> storage adapter is used, which persists the
  16. data in a <classname>Zend_Session_Namespace</classname> instance.
  17. </para>
  18. </sect2>
  19. <sect2 id="zend.http.user-agent-storage.quick-start">
  20. <title>Quick Start</title>
  21. <para>
  22. The interface provides simply the ability to read from, write to, test for, and clear
  23. data in the persistence backend.
  24. </para>
  25. <programlisting language="php"><![CDATA[
  26. interface Zend_Http_UserAgent_Storage
  27. {
  28. public function isEmpty();
  29. public function read();
  30. public function write($contents);
  31. public function clear();
  32. }
  33. ]]></programlisting>
  34. <para>
  35. By default, the <classname>Zend_Http_UserAgent_Storage_Session</classname> adapter is
  36. utilized. That adapter writes to a unique <classname>Zend_Session_Namespace</classname>
  37. for the given user.
  38. </para>
  39. </sect2>
  40. <sect2 id="zend.http.user-agent-storage.options">
  41. <title>Configuration Options</title>
  42. <para>
  43. See the individual storage adapters for configuration options. Most adapters will accept
  44. an array or object as an argument to the constructor, and the
  45. <classname>UserAgent</classname> class allows passing an array of options.
  46. </para>
  47. </sect2>
  48. <sect2 id="zend.http.user-agent-storage.methods">
  49. <title>Available Methods</title>
  50. <variablelist>
  51. <varlistentry id="zend.view.helpers.initial.tiny-src.methods.is-empty">
  52. <term>
  53. <methodsynopsis>
  54. <methodname>isEmpty</methodname>
  55. </methodsynopsis>
  56. </term>
  57. <listitem>
  58. <para>
  59. Test whether ornot the storage adapter has an entry. Returns true if the
  60. storage is currently unpopulated.
  61. </para>
  62. </listitem>
  63. </varlistentry>
  64. <varlistentry id="zend.view.helpers.initial.tiny-src.methods.read">
  65. <term>
  66. <methodsynopsis>
  67. <methodname>read</methodname>
  68. </methodsynopsis>
  69. </term>
  70. <listitem>
  71. <para>
  72. Reads data from storage; the data will be serialized PHP.
  73. </para>
  74. </listitem>
  75. </varlistentry>
  76. <varlistentry id="zend.view.helpers.initial.tiny-src.methods.write">
  77. <term>
  78. <methodsynopsis>
  79. <methodname>write</methodname>
  80. <methodparam>
  81. <funcparams>$contents</funcparams>
  82. </methodparam>
  83. </methodsynopsis>
  84. </term>
  85. <listitem>
  86. <para>
  87. Write a serialized string to the storage engine.
  88. </para>
  89. </listitem>
  90. </varlistentry>
  91. <varlistentry id="zend.view.helpers.initial.tiny-src.methods.clear">
  92. <term>
  93. <methodsynopsis>
  94. <methodname>clear</methodname>
  95. </methodsynopsis>
  96. </term>
  97. <listitem>
  98. <para>
  99. Should empty the storage; calling <methodname>isEmpty()</methodname> following a
  100. <methodname>clear()</methodname> operation should return
  101. <constant>true</constant>.
  102. </para>
  103. </listitem>
  104. </varlistentry>
  105. </variablelist>
  106. </sect2>
  107. </sect1>