Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[DOCUMENTATION] English:

- fixed title tags

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@15234 44c647ce-9c0f-0410-b52a-842ac1e357ba
  • Loading branch information...
commit e443b8c12a05ad49b9a583e17f1a08b9db2be267 0 parents
thomas authored
Showing with 27,472 additions and 0 deletions.
  1. +83 −0 INSTALL.txt
  2. +27 −0 LICENSE.txt
  3. +96 −0 README.txt
  4. +44 −0 bin/zf.bat
  5. +78 −0 bin/zf.php
  6. +44 −0 bin/zf.sh
  7. +39 −0 demos/Zend/Feeds/consume-feed.php
  8. +373 −0 demos/Zend/Gdata/Blogger.php
  9. +136 −0 demos/Zend/Gdata/BooksBrowser/books_browser.css
  10. +155 −0 demos/Zend/Gdata/BooksBrowser/index.php
  11. +81 −0 demos/Zend/Gdata/BooksBrowser/interface.html
  12. +841 −0 demos/Zend/Gdata/Calendar.php
  13. +940 −0 demos/Zend/Gdata/Docs.php
  14. +1,992 −0 demos/Zend/Gdata/Gapps.php
  15. +670 −0 demos/Zend/Gdata/Gbase.php
  16. +386 −0 demos/Zend/Gdata/Health.php
  17. +386 −0 demos/Zend/Gdata/InstallationChecker.php
  18. +226 −0 demos/Zend/Gdata/MyLibrary/demo.php
  19. +904 −0 demos/Zend/Gdata/Photos.php
  20. +454 −0 demos/Zend/Gdata/Spreadsheet-ClientLogin.php
  21. +44 −0 demos/Zend/Gdata/YouTubeVideoApp/README.txt
  22. +193 −0 demos/Zend/Gdata/YouTubeVideoApp/index.php
  23. BIN  demos/Zend/Gdata/YouTubeVideoApp/notfound.jpg
  24. +1,097 −0 demos/Zend/Gdata/YouTubeVideoApp/operations.php
  25. +66 −0 demos/Zend/Gdata/YouTubeVideoApp/session_details.php
  26. +236 −0 demos/Zend/Gdata/YouTubeVideoApp/video_app.css
  27. +582 −0 demos/Zend/Gdata/YouTubeVideoApp/video_app.js
  28. +278 −0 demos/Zend/Gdata/YouTubeVideoBrowser/index.php
  29. +79 −0 demos/Zend/Gdata/YouTubeVideoBrowser/interface.html
  30. +152 −0 demos/Zend/Gdata/YouTubeVideoBrowser/video_browser.css
  31. +228 −0 demos/Zend/Gdata/YouTubeVideoBrowser/video_browser.js
  32. +43 −0 demos/Zend/Locale/AllLanguages.php
  33. +449 −0 demos/Zend/Mail/SimpleMailer.php
  34. BIN  demos/Zend/Mail/maildir/maildir.tar
  35. +100 −0 demos/Zend/Mail/mbox/INBOX
  36. +14 −0 demos/Zend/Mail/mbox/subfolder/test
  37. BIN  demos/Zend/OpenId/login-bg.gif
  38. +64 −0 demos/Zend/OpenId/mvc_auth/application/controllers/ErrorController.php
  39. +112 −0 demos/Zend/OpenId/mvc_auth/application/controllers/IndexController.php
  40. +12 −0 demos/Zend/OpenId/mvc_auth/application/views/scripts/error/404.phtml
  41. +12 −0 demos/Zend/OpenId/mvc_auth/application/views/scripts/error/500.phtml
  42. +17 −0 demos/Zend/OpenId/mvc_auth/application/views/scripts/index/login.phtml
  43. +14 −0 demos/Zend/OpenId/mvc_auth/application/views/scripts/index/welcome.phtml
  44. +2 −0  demos/Zend/OpenId/mvc_auth/html/.htaccess
  45. +1 −0  demos/Zend/OpenId/mvc_auth/html/config.ini
  46. +36 −0 demos/Zend/OpenId/mvc_auth/html/index.php
  47. +9 −0 demos/Zend/OpenId/templates/identity.phtml
  48. +10 −0 demos/Zend/OpenId/templates/identity2.phtml
  49. +83 −0 demos/Zend/OpenId/templates/login.phtml
  50. +14 −0 demos/Zend/OpenId/templates/profile.phtml
  51. +69 −0 demos/Zend/OpenId/templates/register.phtml
  52. +11 −0 demos/Zend/OpenId/templates/registration_complete.phtml
  53. +18 −0 demos/Zend/OpenId/templates/trust.phtml
  54. +68 −0 demos/Zend/OpenId/test_auth.php
  55. +128 −0 demos/Zend/OpenId/test_consumer.php
  56. +268 −0 demos/Zend/OpenId/test_server.php
  57. +262 −0 demos/Zend/Pdf/demo.php
  58. BIN  demos/Zend/Pdf/stamp.jpg
  59. BIN  demos/Zend/Pdf/test.pdf
  60. +165 −0 demos/Zend/ProgressBar/JsPush.php
  61. +218 −0 demos/Zend/ProgressBar/Upload.php
  62. +225 −0 demos/Zend/ProgressBar/ZendForm.php
  63. BIN  demos/Zend/ProgressBar/animation.gif
  64. +57 −0 demos/Zend/Search/Lucene/feed-search/create-index.php
  65. +43 −0 demos/Zend/Search/Lucene/feed-search/search-index.php
  66. +97 −0 demos/Zend/Search/Lucene/indexing/CreateIndex.php
  67. +179 −0 demos/Zend/Search/Lucene/indexing/IndexSource/about-pear.html
  68. +235 −0 demos/Zend/Search/Lucene/indexing/IndexSource/authors.html
  69. +185 −0 demos/Zend/Search/Lucene/indexing/IndexSource/contributing.bugs.html
  70. +165 −0 demos/Zend/Search/Lucene/indexing/IndexSource/contributing.documentation.html
  71. +201 −0 demos/Zend/Search/Lucene/indexing/IndexSource/contributing.html
  72. +151 −0 demos/Zend/Search/Lucene/indexing/IndexSource/contributing.newpackage.html
  73. +274 −0 demos/Zend/Search/Lucene/indexing/IndexSource/contributing.patches.html
  74. +158 −0 demos/Zend/Search/Lucene/indexing/IndexSource/contributing.wishlist.html
  75. +196 −0 demos/Zend/Search/Lucene/indexing/IndexSource/copyright.html
  76. +159 −0 demos/Zend/Search/Lucene/indexing/IndexSource/core.html
  77. +214 −0 demos/Zend/WebServices/Amazon/amazon-search.php
  78. +162 −0 demos/Zend/WebServices/Flickr/flickr-composite.php
  79. +41 −0 demos/Zend/WebServices/Flickr/flickr-search.php
  80. +31 −0 demos/Zend/WebServices/Protocols/xmlrpc-upc-lookup.php
  81. +153 −0 demos/Zend/WebServices/Yahoo/yahoo-multi-search.php
  82. +18 −0 demos/Zend/Wildfire/application/controllers/Boot/Zend-Db-Profiler-Firebug/IndexController.php
  83. +13 −0 demos/Zend/Wildfire/application/controllers/Boot/Zend-Log-Writer-Firebug/IndexController.php
  84. +51 −0 demos/Zend/Wildfire/application/controllers/ErrorController.php
  85. +38 −0 demos/Zend/Wildfire/application/controllers/IndexController.php
  86. +91 −0 demos/Zend/Wildfire/application/controllers/ZendDbProfilerFirebugController.php
  87. +79 −0 demos/Zend/Wildfire/application/controllers/ZendLogWriterFirebugController.php
  88. +44 −0 demos/Zend/Wildfire/application/controllers/ZendWildfirePluginFirePhpController.php
  89. +16 −0 demos/Zend/Wildfire/application/views/scripts/error/error.phtml
  90. +57 −0 demos/Zend/Wildfire/application/views/scripts/index/index.phtml
  91. +16 −0 demos/Zend/Wildfire/application/views/scripts/zend-db-profiler-firebug/test-logging.phtml
  92. +16 −0 demos/Zend/Wildfire/application/views/scripts/zend-db-profiler-firebug/test-multiple-databases.phtml
  93. 0  demos/Zend/Wildfire/application/views/scripts/zend-log-writer-firebug/test-error-controller.phtml
  94. +16 −0 demos/Zend/Wildfire/application/views/scripts/zend-log-writer-firebug/test-large-message.phtml
  95. +16 −0 demos/Zend/Wildfire/application/views/scripts/zend-log-writer-firebug/test-logging.phtml
  96. +16 −0 demos/Zend/Wildfire/application/views/scripts/zend-wildfire-plugin-firephp/test-groups.phtml
  97. +6 −0 demos/Zend/Wildfire/public/.htaccess
  98. +51 −0 demos/Zend/Wildfire/public/Boot/Zend-Db-Profiler-Firebug/TestDocExample.php
  99. +41 −0 demos/Zend/Wildfire/public/Boot/Zend-Log-Writer-Firebug/TestDocExample.php
  100. +66 −0 demos/Zend/Wildfire/public/index.php
  101. +7 −0 documentation/manual/.svnignore/base
  102. +2 −0  documentation/manual/.svnignore/html
  103. +48 −0 documentation/manual/Makefile
  104. +67 −0 documentation/manual/README.txt
  105. +106 −0 documentation/manual/ar/Makefile.in
  106. +50 −0 documentation/manual/ar/README
  107. +87 −0 documentation/manual/ar/configure.in
  108. BIN  documentation/manual/ar/figures/MVC-Flow-Diagram.png
  109. +47 −0 documentation/manual/ar/html.xsl.in
  110. +91 −0 documentation/manual/ar/html/dbstyle.css
  111. +20 −0 documentation/manual/ar/manual-lint.xml.in
  112. +656 −0 documentation/manual/ar/manual.xml.in
  113. +202 −0 documentation/manual/ar/module_specs/Zend_Cache-Backends.xml
  114. +710 −0 documentation/manual/ar/module_specs/Zend_Cache-Frontends.xml
  115. +133 −0 documentation/manual/ar/module_specs/Zend_Cache-Introduction.xml
  116. +129 −0 documentation/manual/ar/module_specs/Zend_Cache-Theory.xml
  117. +56 −0 documentation/manual/ar/module_specs/Zend_Config-Introduction.xml
  118. +54 −0 documentation/manual/ar/module_specs/Zend_Config-TheoryOfOperation.xml
  119. +67 −0 documentation/manual/ar/module_specs/Zend_Config_Ini.xml
  120. +71 −0 documentation/manual/ar/module_specs/Zend_Config_Xml.xml
  121. +64 −0 documentation/manual/ar/module_specs/Zend_Filter.xml
  122. +17 −0 documentation/manual/ar/module_specs/Zend_Json-Basics.xml
  123. +17 −0 documentation/manual/ar/module_specs/Zend_Json-Introduction.xml
  124. +35 −0 documentation/manual/ar/module_specs/Zend_Json-Objects.xml
  125. +25 −0 documentation/manual/ar/module_specs/Zend_Service.xml
  126. +154 −0 documentation/manual/ar/module_specs/Zend_View-Controllers.xml
  127. +173 −0 documentation/manual/ar/module_specs/Zend_View-Scripts.xml
  128. +19 −0 documentation/manual/ar/module_specs/Zend_XmlRpc.xml
  129. +16 −0 documentation/manual/ar/ref/copyrights.xml
  130. +19 −0 documentation/manual/ar/xinclude.mod
  131. +106 −0 documentation/manual/bg/Makefile.in
  132. +50 −0 documentation/manual/bg/README
  133. +87 −0 documentation/manual/bg/configure.in
  134. BIN  documentation/manual/bg/figures/zend.controller.basics.png
  135. BIN  documentation/manual/bg/figures/zend.db.adapter.example-database.png
  136. +47 −0 documentation/manual/bg/html.xsl.in
  137. +79 −0 documentation/manual/bg/html/dbstyle.css
  138. +20 −0 documentation/manual/bg/manual-lint.xml.in
  139. +652 −0 documentation/manual/bg/manual.xml.in
  140. +98 −0 documentation/manual/bg/module_specs/Zend_Acl-Advanced.xml
  141. +344 −0 documentation/manual/bg/module_specs/Zend_Acl.xml
  142. +19 −0 documentation/manual/bg/xinclude.mod
  143. +106 −0 documentation/manual/cs/Makefile.in
  144. +50 −0 documentation/manual/cs/README
  145. +87 −0 documentation/manual/cs/configure.in
  146. BIN  documentation/manual/cs/figures/MVC-Flow-Diagram.png
  147. +47 −0 documentation/manual/cs/html.xsl.in
  148. +79 −0 documentation/manual/cs/html/dbstyle.css
  149. +20 −0 documentation/manual/cs/manual-lint.xml.in
  150. +652 −0 documentation/manual/cs/manual.xml.in
  151. +69 −0 documentation/manual/cs/module_specs/Zend_Debug.xml
  152. +33 −0 documentation/manual/cs/module_specs/Zend_Exception.xml
  153. +18 −0 documentation/manual/cs/module_specs/Zend_Json-Basics.xml
  154. +28 −0 documentation/manual/cs/module_specs/Zend_Json-Introduction.xml
  155. +43 −0 documentation/manual/cs/module_specs/Zend_Json-Objects.xml
  156. +115 −0 documentation/manual/cs/module_specs/Zend_Json-xml2json.xml
  157. +21 −0 documentation/manual/cs/module_specs/Zend_Server.xml
  158. +74 −0 documentation/manual/cs/module_specs/Zend_Service.xml
  159. +33 −0 documentation/manual/cs/module_specs/Zend_Version.xml
  160. +16 −0 documentation/manual/cs/ref/copyrights.xml
  161. +81 −0 documentation/manual/cs/ref/installation.xml
  162. +19 −0 documentation/manual/cs/ref/overview.xml
  163. +956 −0 documentation/manual/cs/ref/requirements.xml
  164. +19 −0 documentation/manual/cs/xinclude.mod
  165. +126 −0 documentation/manual/de/Makefile.in
  166. +55 −0 documentation/manual/de/README
  167. +87 −0 documentation/manual/de/configure.in
  168. BIN  documentation/manual/de/figures/zend.controller.basics.png
  169. BIN  documentation/manual/de/figures/zend.db.adapter.example-database.png
  170. BIN  documentation/manual/de/figures/zend.layout.quickstart.example.png
  171. BIN  documentation/manual/de/figures/zend.openid.protocol.jpg
  172. BIN  documentation/manual/de/figures/zend.paginator.usage.rendering.control.png
  173. BIN  documentation/manual/de/figures/zend.wildfire.firebug.console.png
  174. +47 −0 documentation/manual/de/html.xsl.in
  175. +79 −0 documentation/manual/de/html/dbstyle.css
  176. +20 −0 documentation/manual/de/manual-lint.xml.in
  177. +284 −0 documentation/manual/de/manual-print1.xml.in
  178. +276 −0 documentation/manual/de/manual-print2.xml.in
  179. +570 −0 documentation/manual/de/manual.xml.in
  180. +109 −0 documentation/manual/de/module_specs/Zend_Acl-Advanced.xml
  181. +199 −0 documentation/manual/de/module_specs/Zend_Acl-Refining.xml
  182. +380 −0 documentation/manual/de/module_specs/Zend_Acl.xml
  183. +643 −0 documentation/manual/de/module_specs/Zend_Amf-Server.xml
  184. +26 −0 documentation/manual/de/module_specs/Zend_Amf.xml
  185. +78 −0 documentation/manual/de/module_specs/Zend_Application-AvailableResources-Db.xml
  186. +111 −0 documentation/manual/de/module_specs/Zend_Application-AvailableResources-Frontcontroller.xml
  187. +96 −0 documentation/manual/de/module_specs/Zend_Application-AvailableResources-Modules.xml
  188. +69 −0 documentation/manual/de/module_specs/Zend_Application-AvailableResources-Session.xml
  189. +33 −0 documentation/manual/de/module_specs/Zend_Application-AvailableResources-View.xml
  190. +17 −0 documentation/manual/de/module_specs/Zend_Application-AvailableResources.xml
  191. +250 −0 documentation/manual/de/module_specs/Zend_Application-CoreFunctionality-Application.xml
  192. +21 −0 documentation/manual/de/module_specs/Zend_Application-CoreFunctionality-Bootstrap_Bootstrap.xml
Sorry, we could not display the entire diff because too many files (6,456) changed.
83 INSTALL.txt
@@ -0,0 +1,83 @@
+INSTALLATION
+------------
+
+Zend Framework requires no special installation steps. Simply download the framework,
+extract it to the folder you would like to keep it in, and add the library directory
+to your PHP include_path. To use components in the extras library, add the extras/library
+directory to your PHP include_path, as well.
+If you would like to use Zend_Tool, simply add bin/zf.bat (for Windows) or
+bin/zf.sh (for anything else) to your system executable path.
+
+SYSTEM REQUIREMENTS
+-------------------
+
+Zend Framework requires PHP 5.2.4 or later. Please see the system requirements
+appendix for more detailed information:
+
+http://framework.zend.com/manual/en/requirements.html
+
+DEVELOPMENT VERSIONS
+--------------------
+
+If you would like to preview enhancements or bug fixes that have not yet been
+released, you can obtain the current development version of Zend Framework using one
+of the following methods:
+
+* Download the latest nightly snapshot. For those who care to brave the cutting
+ (often bleeding) edge, the nightly snapshots represent the latest single-
+ download development version of Zend Framework development. Snapshots are bundled
+ with documentation in English only or in all available languages. If you anticipate
+ updating to the latest development version of Zend Framework often, consider using
+ Subversion as described below.
+
+ http://framework.zend.com/download/snapshot
+
+* Using a Subversion (SVN) client. Zend Framework is open source software, and
+ the Subversion repository used for its development is publicly available. Consider
+ using SVN to get Zend Framework if you already use SVN for your application
+ development, want to contribute back to the framework, or need to upgrade your
+ framework version very often.
+
+ Exporting is useful if you want to get a particular framework revision without the
+ .svn directories as created in a working copy.
+
+ Checking out a working copy is necessary if you would like to directly contribute
+ to Zend Framework; a working copy can be updated any time with svn update.
+
+ An externals definition is highly convenient for developers already using SVN to
+ manage their application working copies.
+
+ The URL for the trunk of the Zend Framework SVN repository is:
+
+ http://framework.zend.com/svn/framework/trunk
+
+ For more information about Subversion, please see the official website:
+
+ http://subversion.tigris.org
+
+CONFIGURING THE INCLUDE PATH
+----------------------------
+
+Once you have a copy of Zend Framework available, your application will need to
+access the framework classes. Though there are several ways to achieve this, your
+PHP include_path needs to contain the path to the Zend Framework classes under the
+/library directory in this distribution. You can find out more about the PHP
+include_path configuration directive here:
+
+http://www.php.net/manual/en/ini.core.php#ini.include-path
+
+Instructions on how to change PHP configuration directives can be found here:
+
+http://www.php.net/manual/en/configuration.changes.php
+
+GETTING STARTED
+---------------
+
+A great place to get up-to-speed quickly is the Zend Framework QuickStart:
+
+http://framework.zend.com/docs/quickstart
+
+The QuickStart covers some of the most commonly used components of ZF. Since
+Zend Framework is designed with a use-at-will architecture and components are
+loosely coupled, you can select and use only those components that are needed for
+your project.
27 LICENSE.txt
@@ -0,0 +1,27 @@
+Copyright (c) 2005-2008, Zend Technologies USA, Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ * Neither the name of Zend Technologies USA, Inc. nor the names of its
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
96 README.txt
@@ -0,0 +1,96 @@
+Welcome to the Zend Framework 1.8 Release!
+
+RELEASE INFORMATION
+---------------
+Zend Framework 1.8 Release (revision 15226).
+Released on April 30, 2009.
+
+NEW FEATURES
+------------
+
+* Zend_Tool, contributed by Ralph Schindler
+* Zend_Application, contributed by Ben Scholzen and Matthew Weier O'Phinney
+* Zend_Loader_Autoloader and Zend_Loader_Autoloader_Resource,
+ contributed by Matthew Weier O'Phinney
+* Zend_Navigation, contributed by Robin Skoglund
+* Zend_CodeGenerator, by Ralph Schindler
+* Zend_Reflection, Ralph Schindler and Matthew Weier O'Phinney
+* Zend Server backend for Zend_Cache, contributed by Alexander Veremyev
+* Zend_Service_Amazon_Ec2, contributed by Jon Whitcraft
+* Zend_Service_Amazon_S3, Justin Plock and Stas Malyshev
+* Zend_Filter_Encrypt, contributed by Thomas Weidner
+* Zend_Filter_Decrypt, contributed by Thomas Weidner
+* Zend_Filter_LocalizedToNormalized and _NormalizedToLocalized,
+ contributed by Thomas Weidner
+* Support for file upload progress support in Zend_File_Transfer,
+ contributed by Thomas Weidner
+* Translation-aware routes, contributed by Ben Scholzen
+* Zend_Json expression support, contributed by Benjamin Eberlei and
+ Oscar Reales
+* Zend_Http_Client_Adapter_Curl, contributed by Benjamin Eberlei
+* SOAP input and output header support, contributed by Alexander Veremyev
+* Support for keyword field search using query strings,
+ contributed by Alexander Veremyev
+* Support for searching across multiple indexes in Zend_Search_Lucene,
+ contributed by Alexander Veremyev
+* Significant improvements for Zend_Search_Lucene search result match
+ highlighting capabilities, contributed by Alexander Veremyev
+* Support for page scaling, shifting and skewing in Zend_Pdf,
+ contributed by Alexander Veremyev
+* Zend_Tag_Cloud, contributed by Ben Scholzen
+* Locale support in Zend_Validate_Int and Zend_Validate_Float,
+ contributed by Thomas Weidner
+* Phonecode support in Zend_Locale, contributed by Thomas Weidner
+* Zend_Validate_Db_RecordExists and _RecordNotExists, contributed by
+ Ryan Mauger
+* Zend_Validate_Iban, contributed by Thomas Weidner
+* Zend_Validate_File_WordCount, contributed by Thomas Weidner
+
+A detailed list of all features and bug fixes in this release may be found at:
+
+http://framework.zend.com/issues/secure/IssueNavigator.jspa?requestId=11002
+
+SYSTEM REQUIREMENTS
+-------------------
+
+Zend Framework requires PHP 5.2.4 or later. Please see our reference
+guide for more detailed system requirements:
+
+http://framework.zend.com/manual/en/requirements.html
+
+INSTALLATION
+------------
+
+Please see INSTALL.txt.
+
+QUESTIONS AND FEEDBACK
+----------------------
+
+Online documentation can be found at http://framework.zend.com/manual.
+Questions that are not addressed in the manual should be directed to the
+appropriate mailing list:
+
+http://framework.zend.com/wiki/display/ZFDEV/Mailing+Lists
+
+If you find code in this release behaving in an unexpected manner or
+contrary to its documented behavior, please create an issue in the Zend
+Framework issue tracker at:
+
+http://framework.zend.com/issues
+
+If you would like to be notified of new releases, you can subscribe to
+the fw-announce mailing list by sending a blank message to
+fw-announce-subscribe@lists.zend.com.
+
+LICENSE
+-------
+
+The files in this archive are released under the Zend Framework license.
+You can find a copy of this license in LICENSE.txt.
+
+ACKNOWLEDGEMENTS
+----------------
+
+The Zend Framework team would like to thank all the contributors to the Zend
+Framework project, our corporate sponsor, and you, the Zend Framework user.
+Please visit us sometime soon at http://framework.zend.com.
44 bin/zf.bat
@@ -0,0 +1,44 @@
+@ECHO off
+REM Zend Framework
+REM
+REM LICENSE
+REM
+REM This source file is subject to the new BSD license that is bundled
+REM with this package in the file LICENSE.txt.
+REM It is also available through the world-wide-web at this URL:
+REM http://framework.zend.com/license/new-bsd
+REM If you did not receive a copy of the license and are unable to
+REM obtain it through the world-wide-web, please send an email
+REM to license@zend.com so we can send you a copy immediately.
+REM
+REM Zend
+REM Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+REM http://framework.zend.com/license/new-bsd New BSD License
+
+
+REM Test to see if this was installed via pear
+SET ZTMPZTMPZTMPZ=@ph
+SET TMPZTMPZTMP=%ZTMPZTMPZTMPZ%p_bin@
+REM below @php_bin@
+FOR %%x IN ("@php_bin@") DO (if %%x=="%TMPZTMPZTMP%" GOTO :NON_PEAR_INSTALLED)
+
+GOTO PEAR_INSTALLED
+
+:NON_PEAR_INSTALLED
+REM Assume php.exe is executable, and that zf.php will reside in the
+REM same file as this one
+SET PHP_BIN=php.exe
+SET PHP_DIR=%~dp0
+GOTO RUN
+
+:PEAR_INSTALLED
+REM Assume this was installed via PEAR and use replacements php_bin & php_dir
+SET PHP_BIN=@php_bin@
+SET PHP_DIR=@php_dir@
+GOTO RUN
+
+:RUN
+SET ZF_SCRIPT=%PHP_DIR%\zf.php
+"%PHP_BIN%" -d safe_mode=Off -f "%ZF_SCRIPT%" -- %*
+
+
78 bin/zf.php
@@ -0,0 +1,78 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Tool
+ * @subpackage Framework
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+
+$_zf['original'] = get_include_path();
+
+// if ZF is not in the include_path, but relative to this file, put it in the include_path
+if (($_zf['prepend'] = getenv('ZEND_TOOL_INCLUDE_PATH_PREPEND')) || ($_zf['whole'] = getenv('ZEND_TOOL_INCLUDE_PATH'))) {
+ if (isset($_zf['prepend']) && ($_zf['prepend'] !== false) && (($_zf['prependRealpath'] = realpath($_zf['prepend'])) !== false)) {
+ set_include_path($_zf['prependRealpath'] . PATH_SEPARATOR . $_zf['original']);
+ } elseif (isset($_zf['whole']) && ($_zf['whole'] !== false) && (($_zf['wholeRealpath'] = realpath($_zf['whole'])) !== false)) {
+ set_include_path($_zf['wholeRealpath']);
+ }
+}
+
+// assume the include_path is good, and load the client/console
+if ((@include_once 'Zend/Tool/Framework/Client/Console.php') === false) {
+ // last chance, perhaps we can find zf relative to THIS file, if so, lets run
+ $_zf['relativePath'] = dirname(__FILE__) . '/../library/';
+ if (file_exists($_zf['relativePath'] . 'Zend/Tool/Framework/Client/Console.php')) {
+ set_include_path(realpath($_zf['relativePath']) . PATH_SEPARATOR . get_include_path());
+ include_once 'Zend/Tool/Framework/Client/Console.php';
+ }
+}
+
+if (!class_exists('Zend_Tool_Framework_Client_Console')) {
+ echo <<<EOS
+
+***************************** ZF ERROR ********************************
+In order to run the zf command, you need to ensure that Zend Framework
+is inside your include_path. If you are running this tool without
+ZendFramework in your include_path, you can alternatively set one of
+two environment variables to for this tool to work:
+
+a) ZEND_TOOL_INCLUDE_PATH_PREPEND="/path/to/ZendFramework/library"
+
+OR alternatively
+
+b) ZEND_TOOL_INCLUDE_PATH="/path/to/ZendFramework/library"
+
+The former (a) will make the specified Zend Framework first in the
+include_path whereas the latter (b) will replace the include_path
+with the specified path.
+
+Information:
+
+EOS;
+
+ echo ' original include_path: ' . $_zf['original'] . PHP_EOL;
+ echo ' attempted include_path: ' . get_include_path() . PHP_EOL;
+ echo ' script location: ' . $_SERVER['SCRIPT_NAME'] . PHP_EOL;
+ exit(1);
+}
+
+// cleanup the global space
+unset($_zf);
+
+// run tool
+Zend_Tool_Framework_Client_Console::main();
+exit(0);
44 bin/zf.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+#############################################################################
+# Zend Framework
+#
+# LICENSE
+#
+# This source file is subject to the new BSD license that is bundled
+# with this package in the file LICENSE.txt.
+# It is also available through the world-wide-web at this URL:
+# http://framework.zend.com/license/new-bsd
+# If you did not receive a copy of the license and are unable to
+# obtain it through the world-wide-web, please send an email
+# to license@zend.com so we can send you a copy immediately.
+#
+# Zend
+# Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+# http://framework.zend.com/license/new-bsd New BSD License
+#############################################################################
+
+
+# find php: pear first, command -v second, straight up php lastly
+if test "@php_bin@" != '@'php_bin'@'; then
+ PHP_BIN="@php_bin@"
+elif command -v php 1>/dev/null 2>/dev/null; then
+ PHP_BIN=`command -v php`
+else
+ PHP_BIN=php
+fi
+
+# find zf.php: pear first, same directory 2nd,
+if test "@php_dir@" != '@'php_dir'@'; then
+ PHP_DIR="@php_dir@"
+else
+ SELF_LINK="$0"
+ SELF_LINK_TMP="$(readlink "$SELF_LINK")"
+ while test -n "$SELF_LINK_TMP"; do
+ SELF_LINK="$SELF_LINK_TMP"
+ SELF_LINK_TMP="$(readlink "$SELF_LINK")"
+ done
+ PHP_DIR="$(dirname "$SELF_LINK")"
+fi
+
+$PHP_BIN -d safe_mode=Off -f $PHP_DIR/zf.php -- $@
39 demos/Zend/Feeds/consume-feed.php
@@ -0,0 +1,39 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Feed
+ * @subpackage Demos
+ * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/**
+ * Consume an RSS feed and display all of the titles and
+ * associated links within.
+ */
+
+/**
+ * @see Zend_Feed
+ */
+require_once 'Zend/Feed.php';
+
+$feed = Zend_Feed::import('http://news.google.com/?output=rss');
+
+foreach ($feed->items as $item) {
+
+ echo "<p>" . $item->title() . "<br />";
+ echo $item->link() . "</p>";
+
+}
373 demos/Zend/Gdata/Blogger.php
@@ -0,0 +1,373 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Gdata
+ * @subpackage Demos
+ * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/*
+* This sample utilizes the Zend Gdata Client Library, which can be
+* downloaded from: http://framework.zend.com/download
+*
+* This sample is meant to show basic CRUD (Create, Retrieve, Update
+* and Delete) functionality of the Blogger data API, and can only
+* be run from the command line.
+*
+* To run the sample:
+* php Blogger.php --user=email@email.com --pass=password
+*/
+
+/**
+ * @see Zend_Loader
+ */
+require_once 'Zend/Loader.php';
+
+/**
+ * @see Zend_Gdata
+ */
+Zend_Loader::loadClass('Zend_Gdata');
+
+/**
+ * @see Zend_Gdata_Query
+ */
+Zend_Loader::loadClass('Zend_Gdata_Query');
+
+/**
+ * @see Zend_Gdata_ClientLogin
+ */
+Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
+
+
+/**
+ * Class that contains all simple CRUD operations for Blogger.
+ *
+ * @category Zend
+ * @package Zend_Gdata
+ * @subpackage Demos
+ * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class SimpleCRUD
+{
+ /**
+ * $blogID - Blog ID used for demo operations
+ *
+ * @var string
+ */
+ public $blogID;
+
+ /**
+ * $gdClient - Client class used to communicate with the Blogger service
+ *
+ * @var Zend_Gdata_Client
+ */
+ public $gdClient;
+
+
+ /**
+ * Constructor for the class. Takes in user credentials and generates the
+ * the authenticated client object.
+ *
+ * @param string $email The user's email address.
+ * @param string $password The user's password.
+ * @return void
+ */
+ public function __construct($email, $password)
+ {
+ $client = Zend_Gdata_ClientLogin::getHttpClient($email, $password, 'blogger');
+ $this->gdClient = new Zend_Gdata($client);
+ }
+
+ /**
+ * This function retrieves all the blogs associated with the authenticated
+ * user and prompts the user to choose which to manipulate.
+ *
+ * Once the index is selected by the user, the corresponding blogID is
+ * extracted and stored for easy access.
+ *
+ * @return void
+ */
+ public function promptForBlogID()
+ {
+ $query = new Zend_Gdata_Query('http://www.blogger.com/feeds/default/blogs');
+ $feed = $this->gdClient->getFeed($query);
+ $this->printFeed($feed);
+ $input = getInput("\nSelection");
+
+ //id text is of the form: tag:blogger.com,1999:user-blogID.blogs
+ $idText = split('-', $feed->entries[$input]->id->text);
+ $this->blogID = $idText[2];
+ }
+
+ /**
+ * This function creates a new Zend_Gdata_Entry representing a blog
+ * post, and inserts it into the user's blog. It also checks for
+ * whether the post should be added as a draft or as a published
+ * post.
+ *
+ * @param string $title The title of the blog post.
+ * @param string $content The body of the post.
+ * @param boolean $isDraft Whether the post should be added as a draft or as a published post
+ * @return string The newly created post's ID
+ */
+ public function createPost($title, $content, $isDraft=False)
+ {
+ // We're using the magic factory method to create a Zend_Gdata_Entry.
+ // http://framework.zend.com/manual/en/zend.gdata.html#zend.gdata.introdduction.magicfactory
+ $entry = $this->gdClient->newEntry();
+
+ $entry->title = $this->gdClient->newTitle(trim($title));
+ $entry->content = $this->gdClient->newContent(trim($content));
+ $entry->content->setType('text');
+ $uri = "http://www.blogger.com/feeds/" . $this->blogID . "/posts/default";
+
+ if ($isDraft)
+ {
+ $control = $this->gdClient->newControl();
+ $draft = $this->gdClient->newDraft('yes');
+ $control->setDraft($draft);
+ $entry->control = $control;
+ }
+
+ $createdPost = $this->gdClient->insertEntry($entry, $uri);
+ //format of id text: tag:blogger.com,1999:blog-blogID.post-postID
+ $idText = split('-', $createdPost->id->text);
+ $postID = $idText[2];
+
+ return $postID;
+ }
+
+ /**
+ * Prints the titles of all the posts in the user's blog.
+ *
+ * @return void
+ */
+ public function printAllPosts()
+ {
+ $query = new Zend_Gdata_Query('http://www.blogger.com/feeds/' . $this->blogID . '/posts/default');
+ $feed = $this->gdClient->getFeed($query);
+ $this->printFeed($feed);
+ }
+
+ /**
+ * Retrieves the specified post and updates the title and body. Also sets
+ * the post's draft status.
+ *
+ * @param string $postID The ID of the post to update. PostID in <id> field:
+ * tag:blogger.com,1999:blog-blogID.post-postID
+ * @param string $updatedTitle The new title of the post.
+ * @param string $updatedContent The new body of the post.
+ * @param boolean $isDraft Whether the post will be published or saved as a draft.
+ * @return Zend_Gdata_Entry The updated post.
+ */
+ public function updatePost($postID, $updatedTitle, $updatedContent, $isDraft)
+ {
+ $query = new Zend_Gdata_Query('http://www.blogger.com/feeds/' . $this->blogID . '/posts/default/' . $postID);
+ $postToUpdate = $this->gdClient->getEntry($query);
+ $postToUpdate->title->text = $this->gdClient->newTitle(trim($updatedTitle));
+ $postToUpdate->content->text = $this->gdClient->newContent(trim($updatedContent));
+
+ if ($isDraft) {
+ $draft = $this->gdClient->newDraft('yes');
+ } else {
+ $draft = $this->gdClient->newDraft('no');
+ }
+
+ $control = $this->gdClient->newControl();
+ $control->setDraft($draft);
+ $postToUpdate->control = $control;
+ $updatedPost = $postToUpdate->save();
+
+ return $updatedPost;
+ }
+
+ /**
+ * This function uses query parameters to retrieve and print all posts
+ * within a specified date range.
+ *
+ * @param string $startDate Beginning date, inclusive. Preferred format is a RFC-3339 date,
+ * though other formats are accepted.
+ * @param string $endDate End date, exclusive.
+ * @return void
+ */
+ public function printPostsInDateRange($startDate, $endDate)
+ {
+ $query = new Zend_Gdata_Query('http://www.blogger.com/feeds/' . $this->blogID . '/posts/default');
+ $query->setParam('published-min', $startDate);
+ $query->setParam('published-max', $endDate);
+
+ $feed = $this->gdClient->getFeed($query);
+ $this->printFeed($feed);
+ }
+
+ /**
+ * This function creates a new comment and adds it to the specified post.
+ * A comment is created as a Zend_Gdata_Entry.
+ *
+ * @param string $postID The ID of the post to add the comment to. PostID
+ * in the <id> field: tag:blogger.com,1999:blog-blogID.post-postID
+ * @param string $commentText The text of the comment to add.
+ * @return string The ID of the newly created comment.
+ */
+ public function createComment($postID, $commentText)
+ {
+ $uri = 'http://www.blogger.com/feeds/' . $this->blogID . '/' . $postID . '/comments/default';
+
+ $newComment = $this->gdClient->newEntry();
+ $newComment->content = $this->gdClient->newContent($commentText);
+ $newComment->content->setType('text');
+ $createdComment = $this->gdClient->insertEntry($newComment, $uri);
+
+ echo 'Added new comment: ' . $createdComment->content->text . "\n";
+ // Edit link follows format: /feeds/blogID/postID/comments/default/commentID
+ $editLink = split('/', $createdComment->getEditLink()->href);
+ $commentID = $editLink[8];
+
+ return $commentID;
+ }
+
+ /**
+ * This function prints all comments associated with the specified post.
+ *
+ * @param string $postID The ID of the post whose comments we'll print.
+ * @return void
+ */
+ public function printAllComments($postID)
+ {
+ $query = new Zend_Gdata_Query('http://www.blogger.com/feeds/' . $this->blogID . '/' . $postID . '/comments/default');
+ $feed = $this->gdClient->getFeed($query);
+ $this->printFeed($feed);
+ }
+
+ /**
+ * This function deletes the specified comment from a post.
+ *
+ * @param string $postID The ID of the post where the comment is. PostID in
+ * the <id> field: tag:blogger.com,1999:blog-blogID.post-postID
+ * @param string $commentID The ID of the comment to delete. The commentID
+ * in the editURL: /feeds/blogID/postID/comments/default/commentID
+ * @return void
+ */
+ public function deleteComment($postID, $commentID)
+ {
+ $uri = 'http://www.blogger.com/feeds/' . $this->blogID . '/' . $postID . '/comments/default/' . $commentID;
+ $this->gdClient->delete($uri);
+ }
+
+ /**
+ * This function deletes the specified post.
+ *
+ * @param string $postID The ID of the post to delete.
+ * @return void
+ */
+ public function deletePost($postID)
+ {
+ $uri = 'http://www.blogger.com/feeds/' . $this->blogID . '/posts/default/' . $postID;
+ $this->gdClient->delete($uri);
+ }
+
+ /**
+ * Helper function to print out the titles of all supplied Blogger
+ * feeds.
+ *
+ * @param Zend_Gdata_Feed The feed to print.
+ * @return void
+ */
+ public function printFeed($feed)
+ {
+ $i = 0;
+ foreach($feed->entries as $entry)
+ {
+ echo "\t" . $i ." ". $entry->title->text . "\n";
+ $i++;
+ }
+ }
+
+ /**
+ * Runs the sample.
+ *
+ * @return void
+ */
+ public function run()
+ {
+ echo "Note: This sample may Create, Read, Update and Delete data " .
+ "stored in the account provided. Please exit now if you provided " .
+ "an account which contains important data.\n\n";
+ $this->promptForBlogID();
+
+ echo "Creating a post.\n";
+ $this->createPost('Hello, world!', 'I am on the intarweb!', False);
+
+ echo "Creating a draft post.\n";
+ $postID = $this->createPost('Salutations, world!', 'Does not sound right.. must work on title.', True);
+
+ echo "Updating the previous post and publishing it.\n";
+ $updatedPost = $this->updatePost($postID, 'Hello, world, it is.', 'There we go.', False);
+ echo "The new title of the post is: " . $updatedPost->title->text . "\n";
+ echo "The new body of the post is: " . $updatedPost->content->text . "\n";
+
+ echo "Adding a comment to the previous post.\n";
+ $this->createComment($postID, 'I am so glad this is public now.');
+
+ echo "Adding another comment.\n";
+ $commentID = $this->createComment($postID, 'This is a spammy comment.');
+
+ echo "Deleting the previous comment.\n";
+ $this->deleteComment($postID, $commentID);
+
+ echo "Printing all posts.\n";
+ $this->printAllPosts();
+
+ echo "Printing posts between 2007-01-01 and 2007-03-01.\n";
+ $this->printPostsInDateRange('2007-01-01','2007-06-30');
+
+ echo "Deleting the post titled: " . $updatedPost->title->text . "\n";
+ $this->deletePost($postID);
+ }
+}
+
+/**
+ * Gets credentials from user.
+ *
+ * @param string $text
+ * @return string Index of the blog the user has chosen.
+ */
+function getInput($text)
+{
+ echo $text.': ';
+ return trim(fgets(STDIN));
+}
+
+$user = null;
+$pass = null;
+
+// process command line options
+foreach ($argv as $argument) {
+ $argParts = split('=', $argument);
+ if ($argParts[0] == '--user') {
+ $user = $argParts[1];
+ } else if ($argParts[0] == '--pass') {
+ $pass = $argParts[1];
+ }
+}
+
+if (($user == null) || ($pass == null)) {
+ exit("php Blogger.php --user=[username] --pass=[password]\n");
+}
+
+$sample = new SimpleCRUD($user, $pass);
+$sample->run();
136 demos/Zend/Gdata/BooksBrowser/books_browser.css
@@ -0,0 +1,136 @@
+body {
+ background-color: white;
+ color: black;
+ font-family: Arial, sans-serif;
+ font-size: small;
+ margin: 8px;
+ margin-top: 3px;
+}
+
+.thumbnail img {
+ border-color:black;
+ border-width:1;
+ border-style:solid;
+}
+
+table {
+ border-collapse: collapse;
+}
+
+th, td {
+ padding: 0;
+ vertical-align: top;
+ text-align: left;
+ font-size: small;
+}
+
+a:link {
+ color: #0000cc;
+}
+
+a:active {
+ color: #cc0000;
+}
+
+a:visited {
+ color: #551a8b;
+}
+
+h1 {
+ font-size: x-large;
+ margin-top: 0px;
+ margin-bottom: 5px;
+}
+
+h2 {
+ font-size: large;
+}
+
+form {
+ display: inline;
+ margin: 0;
+ padding: 0;
+}
+
+.volumeList td {
+ padding-bottom: 5px;
+ padding-right: 5px;
+}
+
+#titleBar {
+ border: 1px solid silver;
+ background-color: #e5ecf9;
+ font-size: large;
+ font-weight: bold;
+ margin: 0;
+ padding: 0;
+ padding-top: 5px;
+ padding-bottom: 10px;
+ padding-left: 10px;
+ padding-right: 10px;
+ margin-top: 5px;
+ margin-bottom: 15px;
+}
+
+#titleText {
+ float: left;
+}
+
+#mainSearchBox {
+ background-color: #e5ecf9;
+ border: 1px solid silver;
+ width: 300;
+ padding-top: 5px;
+ padding-bottom: 10px;
+ padding-left: 10px;
+ padding-right: 10px;
+}
+
+#searchResults {
+ width: 100%;
+}
+
+.volumeList td
+{
+ border-top: 1px solid #aaaaaa;
+ padding: 6px;
+}
+
+.thumbnail
+{
+ height: 80px;
+ padding: 3px;
+}
+
+.previewbutton
+{
+ border: 0px;
+ margin: 6px 0px 6px 0px;
+}
+
+#resultcell
+{
+ padding-right: 20px;
+}
+
+#previewcell
+{
+ border-left: 1px dotted #aaa;
+ padding-left: 20px;
+ display: none;
+ padding-right: 20px;
+}
+
+#viewport {
+ height: 500px;
+ width: 100%;
+ border: 1px solid #aaa;
+
+}
+
+/* Google Preview: Boilerplate styling */
+#viewport { font-size: 16px; line-height: 1; }
+#viewport img, #viewport table, #viewport div, #viewport td
+{ border: 0; padding: 0; margin: 0; background: none }
+#viewport td { vertical-align: middle }
+
155 demos/Zend/Gdata/BooksBrowser/index.php
@@ -0,0 +1,155 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Gdata
+ * @subpackage Demos
+ * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/**
+ * @see Zend_Loader
+ */
+require_once 'Zend/Loader.php';
+
+/**
+ * @see Zend_Gdata_Books
+ */
+Zend_Loader::loadClass('Zend_Gdata_Books');
+
+/**
+ * Return a comma separated string representing the elements of an array
+ *
+ * @param Array $elements The array of elements
+ * @return string Comma separated string
+ */
+function printArray($elements) {
+ $result = '';
+ foreach ($elements as $element) {
+ if (!empty($result)) $result = $result.', ';
+ $result = $result.$element;
+ }
+ return $result;
+}
+
+
+/**
+ * Echo the list of videos in the specified feed.
+ *
+ * @param Zend_Gdata_Books_BookFeed $feed The video feed
+ * @return void
+ */
+function echoBookList($feed)
+{
+ print <<<HTML
+ <table><tr><td id="resultcell">
+ <div id="searchResults">
+ <table class="volumeList"><tbody width="100%">
+HTML;
+ $flipflop = false;
+ foreach ($feed as $entry) {
+ $title = printArray($entry->getTitles());
+ $volumeId = $entry->getVolumeId();
+ if ($thumbnailLink = $entry->getThumbnailLink()) {
+ $thumbnail = $thumbnailLink->href;
+ } else {
+ $thumbnail = null;
+ }
+ $preview = $entry->getPreviewLink()->href;
+ $embeddability = $entry->getEmbeddability()->getValue();
+ $creators = printArray($entry->getCreators());
+ if (!empty($creators)) $creators = "by " . $creators;
+ if ($embeddability ==
+ "http://schemas.google.com/books/2008#embeddable") {
+ $preview_link = '<a href="javascript:load_viewport(\''.
+ $preview.'\',\'viewport\');">'.
+ '<img class="previewbutton" src="http://code.google.com/' .
+ 'apis/books/images/gbs_preview_button1.png" />' .
+ '</a><br>';
+ } else {
+ $preview_link = '';
+ }
+ $thumbnail_img = (!$thumbnail) ? '' : '<a href="'.$preview.
+ '"><img src="'.$thumbnail.'"/></a>';
+
+ print <<<HTML
+ <tr>
+ <td><div class="thumbnail">
+ $thumbnail_img
+ </div></td>
+ <td width="100%">
+ <a href="${preview}">$title</a><br>
+ $creators<br>
+ $preview_link
+ </td></tr>
+HTML;
+ }
+ print <<<HTML
+ </table></div></td>
+ <td width=50% id="previewcell"><div id="viewport"></div>&nbsp;
+ </td></tr></table><br></body></html>
+HTML;
+}
+
+/*
+ * The main controller logic of the Books volume browser demonstration app.
+ */
+$queryType = isset($_GET['queryType']) ? $_GET['queryType'] : null;
+
+include 'interface.html';
+
+if ($queryType === null) {
+ /* display the entire interface */
+} else {
+ $books = new Zend_Gdata_Books();
+ $query = $books->newVolumeQuery();
+
+ /* display a list of volumes */
+ if (isset($_GET['searchTerm'])) {
+ $searchTerm = $_GET['searchTerm'];
+ $query->setQuery($searchTerm);
+ }
+ if (isset($_GET['startIndex'])) {
+ $startIndex = $_GET['startIndex'];
+ $query->setStartIndex($startIndex);
+ }
+ if (isset($_GET['maxResults'])) {
+ $maxResults = $_GET['maxResults'];
+ $query->setMaxResults($maxResults);
+ }
+ if (isset($_GET['minViewability'])) {
+ $minViewability = $_GET['minViewability'];
+ $query->setMinViewability($minViewability);
+ }
+
+ /* check for one of the restricted feeds, or list from 'all' videos */
+ switch ($queryType) {
+ case 'full_view':
+ case 'partial_view':
+ $query->setMinViewability($queryType);
+ echo 'Requesting feed: ' . ($query->getQueryUrl()) . '<br><br>';
+ $feed = $books->getVolumeFeed($query);
+ break;
+ case 'all':
+ echo 'Requesting feed: ' . ($query->getQueryUrl()) . '<br><br>';
+ $feed = $books->getVolumeFeed($query);
+ break;
+ default:
+ echo 'ERROR - unknown queryType - "' . $queryType . '"';
+ break;
+ }
+ echoBookList($feed);
+}
+
81 demos/Zend/Gdata/BooksBrowser/interface.html
@@ -0,0 +1,81 @@
+<!---
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Gdata
+ * @subpackage Demos
+ * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ *
+ */
+-->
+<html>
+<head>
+ <title>Books Data API Browser in PHP</title>
+ <link href="books_browser.css" type="text/css" rel="stylesheet"/>
+ <script type="text/javascript" src="http://www.google.com/jsapi">
+ </script>
+ <script type="text/javascript">
+ function load_viewport(identifier, viewport_div_id) {
+ var viewport_div = document.getElementById(viewport_div_id);
+ var rightpane_div = viewport_div.parentNode;
+ rightpane_div.style.display = 'table-cell';
+ viewport_div.innerHTML = 'Loading...';
+
+ var viewer = new google.books.DefaultViewer(viewport_div);
+ viewer.load(identifier, handle_not_found);
+ }
+
+ function on_load() {
+ }
+
+ function handle_not_found() {
+ var viewport_div = document.getElementById(viewport_div_id);
+ viewport_div.parentNode.style.display = 'none';
+ }
+
+ google.load('books', '0');
+ google.setOnLoadCallback(on_load);
+ </script>
+
+</head>
+<body>
+ <script>
+ </script>
+<div id="titleBar">
+ <div id="titleText"><h1>Books Data API Browser in PHP</h1></div>
+ <br />
+</div>
+<br clear="all" />
+<div id="mainSearchBox">
+ <h2>Search Books:</h2>
+ <form id="mainSearchForm" action="index.php">
+ <select name="queryType">
+ <option value="all" selected="true">All Books</option>
+ <option value="partial_view">Limited preview and full view</option>
+ <option value="full_view">Full view books only</option>
+ </select>
+ <input name="maxResults" type="hidden" value="6">
+ <input name="searchTerm" type="text" value="">
+ <input type="submit" value="Search">
+ <a href="http://www.google.com"><img
+ src="http://books.google.com/googlebooks/images/poweredby.png"
+ border="0" width="62" height="30" align="absbottom"
+ style="position:relative; top: 6px; padding-left: 10px"></a>
+ </form>
+</div>
+<br>
+<br clear="all" />
+
+
841 demos/Zend/Gdata/Calendar.php
@@ -0,0 +1,841 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Gdata
+ * @subpackage Demos
+ * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/**
+ * PHP sample code for the Google Calendar data API. Utilizes the
+ * Zend Framework Gdata components to communicate with the Google API.
+ *
+ * Requires the Zend Framework Gdata components and PHP >= 5.1.4
+ *
+ * You can run this sample both from the command line (CLI) and also
+ * from a web browser. When running through a web browser, only
+ * AuthSub and outputting a list of calendars is demonstrated. When
+ * running via CLI, all functionality except AuthSub is available and dependent
+ * upon the command line options passed. Run this script without any
+ * command line options to see usage, eg:
+ * /usr/local/bin/php -f Calendar.php
+ *
+ * More information on the Command Line Interface is available at:
+ * http://www.php.net/features.commandline
+ *
+ * NOTE: You must ensure that the Zend Framework is in your PHP include
+ * path. You can do this via php.ini settings, or by modifying the
+ * argument to set_include_path in the code below.
+ *
+ * NOTE: As this is sample code, not all of the functions do full error
+ * handling. Please see getEvent for an example of how errors could
+ * be handled and the online code samples for additional information.
+ */
+
+/**
+ * @see Zend_Loader
+ */
+require_once 'Zend/Loader.php';
+
+/**
+ * @see Zend_Gdata
+ */
+Zend_Loader::loadClass('Zend_Gdata');
+
+/**
+ * @see Zend_Gdata_AuthSub
+ */
+Zend_Loader::loadClass('Zend_Gdata_AuthSub');
+
+/**
+ * @see Zend_Gdata_ClientLogin
+ */
+Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
+
+/**
+ * @see Zend_Gdata_HttpClient
+ */
+Zend_Loader::loadClass('Zend_Gdata_HttpClient');
+
+/**
+ * @see Zend_Gdata_Calendar
+ */
+Zend_Loader::loadClass('Zend_Gdata_Calendar');
+
+/**
+ * @var string Location of AuthSub key file. include_path is used to find this
+ */
+$_authSubKeyFile = null; // Example value for secure use: 'mykey.pem'
+
+/**
+ * @var string Passphrase for AuthSub key file.
+ */
+$_authSubKeyFilePassphrase = null;
+
+/**
+ * Returns the full URL of the current page, based upon env variables
+ *
+ * Env variables used:
+ * $_SERVER['HTTPS'] = (on|off|)
+ * $_SERVER['HTTP_HOST'] = value of the Host: header
+ * $_SERVER['SERVER_PORT'] = port number (only used if not http/80,https/443)
+ * $_SERVER['REQUEST_URI'] = the URI after the method of the HTTP request
+ *
+ * @return string Current URL
+ */
+function getCurrentUrl()
+{
+ global $_SERVER;
+
+ /**
+ * Filter php_self to avoid a security vulnerability.
+ */
+ $php_request_uri = htmlentities(substr($_SERVER['REQUEST_URI'], 0, strcspn($_SERVER['REQUEST_URI'], "\n\r")), ENT_QUOTES);
+
+ if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') {
+ $protocol = 'https://';
+ } else {
+ $protocol = 'http://';
+ }
+ $host = $_SERVER['HTTP_HOST'];
+ if ($_SERVER['SERVER_PORT'] != '' &&
+ (($protocol == 'http://' && $_SERVER['SERVER_PORT'] != '80') ||
+ ($protocol == 'https://' && $_SERVER['SERVER_PORT'] != '443'))) {
+ $port = ':' . $_SERVER['SERVER_PORT'];
+ } else {
+ $port = '';
+ }
+ return $protocol . $host . $port . $php_request_uri;
+}
+
+/**
+ * Returns the AuthSub URL which the user must visit to authenticate requests
+ * from this application.
+ *
+ * Uses getCurrentUrl() to get the next URL which the user will be redirected
+ * to after successfully authenticating with the Google service.
+ *
+ * @return string AuthSub URL
+ */
+function getAuthSubUrl()
+{
+ global $_authSubKeyFile;
+ $next = getCurrentUrl();
+ $scope = 'http://www.google.com/calendar/feeds/';
+ $session = true;
+ if ($_authSubKeyFile != null) {
+ $secure = true;
+ } else {
+ $secure = false;
+ }
+ return Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope, $secure,
+ $session);
+}
+
+/**
+ * Outputs a request to the user to login to their Google account, including
+ * a link to the AuthSub URL.
+ *
+ * Uses getAuthSubUrl() to get the URL which the user must visit to authenticate
+ *
+ * @return void
+ */
+function requestUserLogin($linkText)
+{
+ $authSubUrl = getAuthSubUrl();
+ echo "<a href=\"{$authSubUrl}\">{$linkText}</a>";
+}
+
+/**
+ * Returns a HTTP client object with the appropriate headers for communicating
+ * with Google using AuthSub authentication.
+ *
+ * Uses the $_SESSION['sessionToken'] to store the AuthSub session token after
+ * it is obtained. The single use token supplied in the URL when redirected
+ * after the user succesfully authenticated to Google is retrieved from the
+ * $_GET['token'] variable.
+ *
+ * @return Zend_Http_Client
+ */
+function getAuthSubHttpClient()
+{
+ global $_SESSION, $_GET, $_authSubKeyFile, $_authSubKeyFilePassphrase;
+ $client = new Zend_Gdata_HttpClient();
+ if ($_authSubKeyFile != null) {
+ // set the AuthSub key
+ $client->setAuthSubPrivateKeyFile($_authSubKeyFile, $_authSubKeyFilePassphrase, true);
+ }
+ if (!isset($_SESSION['sessionToken']) && isset($_GET['token'])) {
+ $_SESSION['sessionToken'] =
+ Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token'], $client);
+ }
+ $client->setAuthSubToken($_SESSION['sessionToken']);
+ return $client;
+}
+
+/**
+ * Processes loading of this sample code through a web browser. Uses AuthSub
+ * authentication and outputs a list of a user's calendars if succesfully
+ * authenticated.
+ *
+ * @return void
+ */
+function processPageLoad()
+{
+ global $_SESSION, $_GET;
+ if (!isset($_SESSION['sessionToken']) && !isset($_GET['token'])) {
+ requestUserLogin('Please login to your Google Account.');
+ } else {
+ $client = getAuthSubHttpClient();
+ outputCalendarList($client);
+ }
+}
+
+/**
+ * Returns a HTTP client object with the appropriate headers for communicating
+ * with Google using the ClientLogin credentials supplied.
+ *
+ * @param string $user The username, in e-mail address format, to authenticate
+ * @param string $pass The password for the user specified
+ * @return Zend_Http_Client
+ */
+function getClientLoginHttpClient($user, $pass)
+{
+ $service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
+
+ $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
+ return $client;
+}
+
+/**
+ * Outputs an HTML unordered list (ul), with each list item representing an event
+ * in the user's calendar. The calendar is retrieved using the magic cookie
+ * which allows read-only access to private calendar data using a special token
+ * available from within the Calendar UI.
+ *
+ * @param string $user The username or address of the calendar to be retrieved.
+ * @param string $magicCookie The magic cookie token
+ * @return void
+ */
+function outputCalendarMagicCookie($user, $magicCookie)
+{
+ $gdataCal = new Zend_Gdata_Calendar();
+ $query = $gdataCal->newEventQuery();
+ $query->setUser($user);
+ $query->setVisibility('private-' . $magicCookie);
+ $query->setProjection('full');
+ $eventFeed = $gdataCal->getCalendarEventFeed($query);
+ echo "<ul>\n";
+ foreach ($eventFeed as $event) {
+ echo "\t<li>" . $event->title->text . "</li>\n";
+ $sl = $event->getLink('self')->href;
+ }
+ echo "</ul>\n";
+}
+
+/**
+ * Outputs an HTML unordered list (ul), with each list item representing a
+ * calendar in the authenticated user's calendar list.
+ *
+ * @param Zend_Http_Client $client The authenticated client object
+ * @return void
+ */
+function outputCalendarList($client)
+{
+ $gdataCal = new Zend_Gdata_Calendar($client);
+ $calFeed = $gdataCal->getCalendarListFeed();
+ echo "<h1>" . $calFeed->title->text . "</h1>\n";
+ echo "<ul>\n";
+ foreach ($calFeed as $calendar) {
+ echo "\t<li>" . $calendar->title->text . "</li>\n";
+ }
+ echo "</ul>\n";
+}
+
+/**
+ * Outputs an HTML unordered list (ul), with each list item representing an
+ * event on the authenticated user's calendar. Includes the start time and
+ * event ID in the output. Events are ordered by starttime and include only
+ * events occurring in the future.
+ *
+ * @param Zend_Http_Client $client The authenticated client object
+ * @return void
+ */
+function outputCalendar($client)
+{
+ $gdataCal = new Zend_Gdata_Calendar($client);
+ $query = $gdataCal->newEventQuery();
+ $query->setUser('default');
+ $query->setVisibility('private');
+ $query->setProjection('full');
+ $query->setOrderby('starttime');
+ $query->setFutureevents(true);
+ $eventFeed = $gdataCal->getCalendarEventFeed($query);
+ // option 2
+ // $eventFeed = $gdataCal->getCalendarEventFeed($query->getQueryUrl());
+ echo "<ul>\n";
+ foreach ($eventFeed as $event) {
+ echo "\t<li>" . $event->title->text . " (" . $event->id->text . ")\n";
+ // Zend_Gdata_App_Extensions_Title->__toString() is defined, so the
+ // following will also work on PHP >= 5.2.0
+ //echo "\t<li>" . $event->title . " (" . $event->id . ")\n";
+ echo "\t\t<ul>\n";
+ foreach ($event->when as $when) {
+ echo "\t\t\t<li>Starts: " . $when->startTime . "</li>\n";
+ }
+ echo "\t\t</ul>\n";
+ echo "\t</li>\n";
+ }
+ echo "</ul>\n";
+}
+
+/**
+ * Outputs an HTML unordered list (ul), with each list item representing an
+ * event on the authenticated user's calendar which occurs during the
+ * specified date range.
+ *
+ * To query for all events occurring on 2006-12-24, you would query for
+ * a startDate of '2006-12-24' and an endDate of '2006-12-25' as the upper
+ * bound for date queries is exclusive. See the 'query parameters reference':
+ * http://code.google.com/apis/gdata/calendar.html#Parameters
+ *
+ * @param Zend_Http_Client $client The authenticated client object
+ * @param string $startDate The start date in YYYY-MM-DD format
+ * @param string $endDate The end date in YYYY-MM-DD format
+ * @return void
+ */
+function outputCalendarByDateRange($client, $startDate='2007-05-01',
+ $endDate='2007-08-01')
+{
+ $gdataCal = new Zend_Gdata_Calendar($client);
+ $query = $gdataCal->newEventQuery();
+ $query->setUser('default');
+ $query->setVisibility('private');
+ $query->setProjection('full');
+ $query->setOrderby('starttime');
+ $query->setStartMin($startDate);
+ $query->setStartMax($endDate);
+ $eventFeed = $gdataCal->getCalendarEventFeed($query);
+ echo "<ul>\n";
+ foreach ($eventFeed as $event) {
+ echo "\t<li>" . $event->title->text . " (" . $event->id->text . ")\n";
+ echo "\t\t<ul>\n";
+ foreach ($event->when as $when) {
+ echo "\t\t\t<li>Starts: " . $when->startTime . "</li>\n";
+ }
+ echo "\t\t</ul>\n";
+ echo "\t</li>\n";
+ }
+ echo "</ul>\n";
+}
+
+/**
+ * Outputs an HTML unordered list (ul), with each list item representing an
+ * event on the authenticated user's calendar which matches the search string
+ * specified as the $fullTextQuery parameter
+ *
+ * @param Zend_Http_Client $client The authenticated client object
+ * @param string $fullTextQuery The string for which you are searching
+ * @return void
+ */
+function outputCalendarByFullTextQuery($client, $fullTextQuery='tennis')
+{
+ $gdataCal = new Zend_Gdata_Calendar($client);
+ $query = $gdataCal->newEventQuery();
+ $query->setUser('default');
+ $query->setVisibility('private');
+ $query->setProjection('full');
+ $query->setQuery($fullTextQuery);
+ $eventFeed = $gdataCal->getCalendarEventFeed($query);
+ echo "<ul>\n";
+ foreach ($eventFeed as $event) {
+ echo "\t<li>" . $event->title->text . " (" . $event->id->text . ")\n";
+ echo "\t\t<ul>\n";
+ foreach ($event->when as $when) {
+ echo "\t\t\t<li>Starts: " . $when->startTime . "</li>\n";
+ echo "\t\t</ul>\n";
+ echo "\t</li>\n";
+ }
+ }
+ echo "</ul>\n";
+}
+
+/**
+ * Creates an event on the authenticated user's default calendar with the
+ * specified event details.
+ *
+ * @param Zend_Http_Client $client The authenticated client object
+ * @param string $title The event title
+ * @param string $desc The detailed description of the event
+ * @param string $where
+ * @param string $startDate The start date of the event in YYYY-MM-DD format
+ * @param string $startTime The start time of the event in HH:MM 24hr format
+ * @param string $endDate The end date of the event in YYYY-MM-DD format
+ * @param string $endTime The end time of the event in HH:MM 24hr format
+ * @param string $tzOffset The offset from GMT/UTC in [+-]DD format (eg -08)
+ * @return string The ID URL for the event.
+ */
+function createEvent ($client, $title = 'Tennis with Beth',
+ $desc='Meet for a quick lesson', $where = 'On the courts',
+ $startDate = '2008-01-20', $startTime = '10:00',
+ $endDate = '2008-01-20', $endTime = '11:00', $tzOffset = '-08')
+{
+ $gc = new Zend_Gdata_Calendar($client);
+ $newEntry = $gc->newEventEntry();
+ $newEntry->title = $gc->newTitle(trim($title));
+ $newEntry->where = array($gc->newWhere($where));
+
+ $newEntry->content = $gc->newContent($desc);
+ $newEntry->content->type = 'text';
+
+ $when = $gc->newWhen();
+ $when->startTime = "{$startDate}T{$startTime}:00.000{$tzOffset}:00";
+ $when->endTime = "{$endDate}T{$endTime}:00.000{$tzOffset}:00";
+ $newEntry->when = array($when);
+
+ $createdEntry = $gc->insertEvent($newEntry);
+ return $createdEntry->id->text;
+}
+
+/**
+ * Creates an event on the authenticated user's default calendar using
+ * the specified QuickAdd string.
+ *
+ * @param Zend_Http_Client $client The authenticated client object
+ * @param string $quickAddText The QuickAdd text for the event
+ * @return string The ID URL for the event
+ */
+function createQuickAddEvent ($client, $quickAddText) {
+ $gdataCal = new Zend_Gdata_Calendar($client);
+ $event = $gdataCal->newEventEntry();
+ $event->content = $gdataCal->newContent($quickAddText);
+ $event->quickAdd = $gdataCal->newQuickAdd(true);
+
+ $newEvent = $gdataCal->insertEvent($event);
+ return $newEvent->id->text;
+}
+
+/**
+ * Creates a new web content event on the authenticated user's default
+ * calendar with the specified event details. For simplicity, the event
+ * is created as an all day event and does not include a description.
+ *
+ * @param Zend_Http_Client $client The authenticated client object
+ * @param string $title The event title
+ * @param string $startDate The start date of the event in YYYY-MM-DD format
+ * @param string $endDate The end time of the event in HH:MM 24hr format
+ * @param string $icon URL pointing to a 16x16 px icon representing the event.
+ * @param string $url The URL containing the web content for the event.
+ * @param string $height The desired height of the web content pane.
+ * @param string $width The desired width of the web content pane.
+ * @param string $type The MIME type of the web content.
+ * @return string The ID URL for the event.
+ */
+function createWebContentEvent ($client, $title = 'World Cup 2006',
+ $startDate = '2006-06-09', $endDate = '2006-06-09',
+ $icon = 'http://www.google.com/calendar/images/google-holiday.gif',
+ $url = 'http://www.google.com/logos/worldcup06.gif',
+ $height = '120', $width = '276', $type = 'image/gif'
+ )
+{
+ $gc = new Zend_Gdata_Calendar($client);
+ $newEntry = $gc->newEventEntry();
+ $newEntry->title = $gc->newTitle(trim($title));
+
+ $when = $gc->newWhen();
+ $when->startTime = $startDate;
+ $when->endTime = $endDate;
+ $newEntry->when = array($when);
+
+ $wc = $gc->newWebContent();
+ $wc->url = $url;
+ $wc->height = $height;
+ $wc->width = $width;
+
+ $wcLink = $gc->newLink();
+ $wcLink->rel = "http://schemas.google.com/gCal/2005/webContent";
+ $wcLink->title = $title;
+ $wcLink->type = $type;
+ $wcLink->href = $icon;
+
+ $wcLink->webContent = $wc;
+ $newEntry->link = array($wcLink);
+
+ $createdEntry = $gc->insertEvent($newEntry);
+ return $createdEntry->id->text;
+}
+
+/**
+ * Creates a recurring event on the authenticated user's default calendar with
+ * the specified event details.
+ *
+ * @param Zend_Http_Client $client The authenticated client object
+ * @param string $title The event title
+ * @param string $desc The detailed description of the event
+ * @param string $where
+ * @param string $recurData The iCalendar recurring event syntax (RFC2445)
+ * @return void
+ */
+function createRecurringEvent ($client, $title = 'Tennis with Beth',
+ $desc='Meet for a quick lesson', $where = 'On the courts',
+ $recurData = null)
+{
+ $gc = new Zend_Gdata_Calendar($client);
+ $newEntry = $gc->newEventEntry();
+ $newEntry->title = $gc->newTitle(trim($title));
+ $newEntry->where = array($gc->newWhere($where));
+
+ $newEntry->content = $gc->newContent($desc);
+ $newEntry->content->type = 'text';
+
+ /**
+ * Due to the length of this recurrence syntax, we did not specify
+ * it as a default parameter value directly
+ */
+ if ($recurData == null) {
+ $recurData =
+ "DTSTART;VALUE=DATE:20070501\r\n" .
+ "DTEND;VALUE=DATE:20070502\r\n" .
+ "RRULE:FREQ=WEEKLY;BYDAY=Tu;UNTIL=20070904\r\n";
+ }
+
+ $newEntry->recurrence = $gc->newRecurrence($recurData);
+
+ $gc->post($newEntry->saveXML());
+}
+
+/**
+ * Returns an entry object representing the event with the specified ID.
+ *
+ * @param Zend_Http_Client $client The authenticated client object
+ * @param string $eventId The event ID string
+ * @return Zend_Gdata_Calendar_EventEntry|null if the event is found, null if it's not
+ */
+function getEvent($client, $eventId)
+{
+ $gdataCal = new Zend_Gdata_Calendar($client);
+ $query = $gdataCal->newEventQuery();
+ $query->setUser('default');
+ $query->setVisibility('private');
+ $query->setProjection('full');
+ $query->setEvent($eventId);
+
+ try {
+ $eventEntry = $gdataCal->getCalendarEventEntry($query);
+ return $eventEntry;
+ } catch (Zend_Gdata_App_Exception $e) {
+ var_dump($e);
+ return null;
+ }
+}
+
+/**
+ * Updates the title of the event with the specified ID to be
+ * the title specified. Also outputs the new and old title
+ * with HTML br elements separating the lines
+ *
+ * @param Zend_Http_Client $client The authenticated client object
+ * @param string $eventId The event ID string
+ * @param string $newTitle The new title to set on this event
+ * @return Zend_Gdata_Calendar_EventEntry|null The updated entry
+ */
+function updateEvent ($client, $eventId, $newTitle)
+{
+ $gdataCal = new Zend_Gdata_Calendar($client);
+ if ($eventOld = getEvent($client, $eventId)) {
+ echo "Old title: " . $eventOld->title->text . "<br />\n";
+ $eventOld->title = $gdataCal->newTitle($newTitle);
+ try {
+ $eventOld->save();
+ } catch (Zend_Gdata_App_Exception $e) {
+ var_dump($e);
+ return null;
+ }
+ $eventNew = getEvent($client, $eventId);
+ echo "New title: " . $eventNew->title->text . "<br />\n";
+ return $eventNew;
+ } else {
+ return null;
+ }
+}
+
+/**
+ * Adds an extended property to the event specified as a parameter.
+ * An extended property is an arbitrary name/value pair that can be added
+ * to an event and retrieved via the API. It is not accessible from the
+ * calendar web interface.
+ *
+ * @param Zend_Http_Client $client The authenticated client object
+ * @param string $eventId The event ID string
+ * @param string $name The name of the extended property
+ * @param string $value The value of the extended property
+ * @return Zend_Gdata_Calendar_EventEntry|null The updated entry
+ */
+function addExtendedProperty ($client, $eventId,
+ $name='http://www.example.com/schemas/2005#mycal.id', $value='1234')
+{
+ $gc = new Zend_Gdata_Calendar($client);
+ if ($event = getEvent($client, $eventId)) {
+ $extProp = $gc->newExtendedProperty($name, $value);
+ $extProps = array_merge($event->extendedProperty, array($extProp));
+ $event->extendedProperty = $extProps;
+ $eventNew = $event->save();
+ return $eventNew;
+ } else {
+ return null;
+ }
+}
+
+
+/**
+ * Adds a reminder to the event specified as a parameter.
+ *
+ * @param Zend_Http_Client $client The authenticated client object
+ * @param string $eventId The event ID string
+ * @param integer $minutes Minutes before event to set reminder
+ * @return Zend_Gdata_Calendar_EventEntry|null The updated entry
+ */
+function setReminder($client, $eventId, $minutes=15)
+{
+ $gc = new Zend_Gdata_Calendar($client);
+ $method = "alert";
+ if ($event = getEvent($client, $eventId)) {
+ $times = $event->when;
+ foreach ($times as $when) {
+ $reminder = $gc->newReminder();
+ $reminder->setMinutes($minutes);
+ $reminder->setMethod($method);
+ $when->reminder = array($reminder);
+ }
+ $eventNew = $event->save();
+ return $eventNew;
+ } else {
+ return null;
+ }
+}
+
+/**
+ * Deletes the event specified by retrieving the atom entry object
+ * and calling Zend_Feed_EntryAtom::delete() method. This is for
+ * example purposes only, as it is inefficient to retrieve the entire
+ * atom entry only for the purposes of deleting it.
+ *
+ * @param Zend_Http_Client $client The authenticated client object
+ * @param string $eventId The event ID string
+ * @return void
+ */
+function deleteEventById ($client, $eventId)
+{
+ $event = getEvent($client, $eventId);
+ $event->delete();
+}
+
+/**
+ * Deletes the event specified by calling the Zend_Gdata::delete()
+ * method. The URL is typically in the format of:
+ * http://www.google.com/calendar/feeds/default/private/full/<eventId>
+ *
+ * @param Zend_Http_Client $client The authenticated client object
+ * @param string $url The url for the event to be deleted
+ * @return void
+ */
+function deleteEventByUrl ($client, $url)
+{
+ $gdataCal = new Zend_Gdata_Calendar($client);
+ $gdataCal->delete($url);
+}
+
+/**
+ * Main logic for running this sample code via the command line or,
+ * for AuthSub functionality only, via a web browser. The output of
+ * many of the functions is in HTML format for demonstration purposes,
+ * so you may wish to pipe the output to Tidy when running from the
+ * command-line for clearer results.
+ *
+ * Run without any arguments to get usage information
+ */
+if (isset($argc) && $argc >= 2) {
+ switch ($argv[1]) {
+ case 'outputCalendar':
+ if ($argc == 4) {
+ $client = getClientLoginHttpClient($argv[2], $argv[3]);
+ outputCalendar($client);
+ } else {
+ echo "Usage: php {$argv[0]} {$argv[1]} " .
+ "<username> <password>\n";
+ }
+ break;
+ case 'outputCalendarMagicCookie':
+ if ($argc == 4) {
+ outputCalendarMagicCookie($argv[2], $argv[3]);
+ } else {
+ echo "Usage: php {$argv[0]} {$argv[1]} " .
+ "<username> <magicCookie>\n";
+ }
+ break;
+ case 'outputCalendarByDateRange':
+ if ($argc == 6) {
+ $client = getClientLoginHttpClient($argv[2], $argv[3]);
+ outputCalendarByDateRange($client, $argv[4], $argv[5]);
+ } else {
+ echo "Usage: php {$argv[0]} {$argv[1]} " .
+ "<username> <password> <startDate> <endDate>\n";
+ }
+ break;
+ case 'outputCalendarByFullTextQuery':
+ if ($argc == 5) {
+ $client = getClientLoginHttpClient($argv[2], $argv[3]);
+ outputCalendarByFullTextQuery($client, $argv[4]);
+ } else {
+ echo "Usage: php {$argv[0]} {$argv[1]} " .
+ "<username> <password> <fullTextQuery>\n";
+ }
+ break;
+ case 'outputCalendarList':
+ if ($argc == 4) {
+ $client = getClientLoginHttpClient($argv[2], $argv[3]);
+ outputCalendarList($client);
+ } else {
+ echo "Usage: php {$argv[0]} {$argv[1]} " .
+ "<username> <password>\n";
+ }
+ break;
+ case 'updateEvent':
+ if ($argc == 6) {
+ $client = getClientLoginHttpClient($argv[2], $argv[3]);
+ updateEvent($client, $argv[4], $argv[5]);
+ } else {
+ echo "Usage: php {$argv[0]} {$argv[1]} <username> <password> " .
+ "<eventId> <newTitle>\n";
+ }
+ break;
+ case 'setReminder':
+ if ($argc == 6) {
+ $client = getClientLoginHttpClient($argv[2], $argv[3]);
+ setReminder($client, $argv[4], $argv[5]);
+ } else {
+ echo "Usage: php {$argv[0]} {$argv[1]} <username> <password> " .
+ "<eventId> <minutes>\n";
+ }
+ break;
+ case 'addExtendedProperty':
+ if ($argc == 7) {
+ $client = getClientLoginHttpClient($argv[2], $argv[3]);
+ addExtendedProperty($client, $argv[4], $argv[5], $argv[6]);
+ } else {
+ echo "Usage: php {$argv[0]} {$argv[1]} <username> <password> " .
+ "<eventId> <name> <value>\n";
+ }