Skip to content
Browse files

Now on Zend-1.10.4

  • Loading branch information...
0 parents commit 0fa64d11b26ac5b344df63af10c8c49198568d86 Mike committed
Showing with 11,951 additions and 0 deletions.
  1. +83 −0 INSTALL.txt
  2. +27 −0 LICENSE.txt
  3. +1 −0 README
  4. +86 −0 README.txt
  5. +44 −0 bin/zf.bat
  6. +635 −0 bin/zf.php
  7. +45 −0 bin/zf.sh
  8. +39 −0 demos/Zend/Feeds/consume-feed.php
  9. +373 −0 demos/Zend/Gdata/Blogger.php
  10. +136 −0 demos/Zend/Gdata/BooksBrowser/books_browser.css
  11. +155 −0 demos/Zend/Gdata/BooksBrowser/index.php
  12. +81 −0 demos/Zend/Gdata/BooksBrowser/interface.html
  13. +841 −0 demos/Zend/Gdata/Calendar.php
  14. +940 −0 demos/Zend/Gdata/Docs.php
  15. +1,992 −0 demos/Zend/Gdata/Gapps.php
  16. +670 −0 demos/Zend/Gdata/Gbase.php
  17. +386 −0 demos/Zend/Gdata/Health.php
  18. +386 −0 demos/Zend/Gdata/InstallationChecker.php
  19. +226 −0 demos/Zend/Gdata/MyLibrary/demo.php
  20. +904 −0 demos/Zend/Gdata/Photos.php
  21. +454 −0 demos/Zend/Gdata/Spreadsheet-ClientLogin.php
  22. +44 −0 demos/Zend/Gdata/YouTubeVideoApp/README.txt
  23. +193 −0 demos/Zend/Gdata/YouTubeVideoApp/index.php
  24. BIN demos/Zend/Gdata/YouTubeVideoApp/notfound.jpg
  25. +1,097 −0 demos/Zend/Gdata/YouTubeVideoApp/operations.php
  26. +66 −0 demos/Zend/Gdata/YouTubeVideoApp/session_details.php
  27. +236 −0 demos/Zend/Gdata/YouTubeVideoApp/video_app.css
  28. +582 −0 demos/Zend/Gdata/YouTubeVideoApp/video_app.js
  29. +278 −0 demos/Zend/Gdata/YouTubeVideoBrowser/index.php
  30. +79 −0 demos/Zend/Gdata/YouTubeVideoBrowser/interface.html
  31. +152 −0 demos/Zend/Gdata/YouTubeVideoBrowser/video_browser.css
  32. +228 −0 demos/Zend/Gdata/YouTubeVideoBrowser/video_browser.js
  33. +43 −0 demos/Zend/Locale/AllLanguages.php
  34. +449 −0 demos/Zend/Mail/SimpleMailer.php
  35. BIN demos/Zend/Mail/maildir/maildir.tar
Sorry, we could not display the entire diff because too many files (15,041) 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-2010, 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.
1 README
@@ -0,0 +1 @@
+Mirror is currently set to: http://framework.zend.com/svn/framework/standard/tags/release-1.10.4
86 README.txt
@@ -0,0 +1,86 @@
+Welcome to the Zend Framework 1.10 Release!
+
+RELEASE INFORMATION
+---------------
+Zend Framework 1.10.4 Release ([INSERT REV NUM HERE]).
+Released on <Month> <Day>, <Year>.
+
+NEW FEATURES
+------------
+
+* Zend_Barcode, contributed by Mikael Perraud and Thomas Weidner
+* Zend_Cache_Backend_Static, contributed by Pádraic Brady
+* Zend_Cache_Manager, contributed by Pádraic Brady
+* Zend_Exception - previous exception support, contributed by Marc Bennewitz
+* Zend_Feed_Pubsubhubbub, contributed by Pádraic Brady
+* Zend_Feed_Writer, contributed by Pádraic Brady
+* Zend_Filter_Boolean, contributed by Thomas Weidner
+* Zend_Filter_Compress/Decompress, contributed by Thomas Weidner
+* Zend_Filter_Null, contributed by Thomas Weidner
+* Zend_Log::factory(), contributed by Mark van der Velden and Martin Roest ibuildings
+* Zend_Log_Writer_ZendMonitor, contributed by Matthew Weier O'Phinney
+* Zend_Markup, contributed by Pieter Kokx
+* Zend_Oauth, contributed by Pádraic Brady
+* Zend_Serializer, contributed by Marc Bennewitz
+* Zend_Service_DeveloperGarden, contributed by Marco Kaiser
+* Zend_Service_LiveDocx, contributed by Jonathan Maron
+* Zend_Service_WindowsAzure, contributed by Maarten Balliauw
+* Zend_Validate_Barcode, contributed by Thomas Weidner
+* Zend_Validate_Callback, contributed by Thomas Weidner
+* Zend_Validate_CreditCard, contributed by Thomas Weidner
+* Zend_Validate_PostCode, contributed by Thomas Weidner
+* Additions to Zend_Application resources, including Cachemanager, Dojo, Jquery,
+ Layout, Log, Mail, and Multidb (contributed by Dolf Schimmel)
+* Refactoring of Zend_Loader::loadClass() to conform to PHP Framework Interop
+ Group reference implementation, which allows for autoloading PHP 5.3
+ namespaced code
+* Updated Dojo version to 1.4
+
+A detailed list of all features and bug fixes in this release may be found at:
+
+http://framework.zend.com/changelog/
+
+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-2010 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%" -- %*
+
+
635 bin/zf.php
@@ -0,0 +1,635 @@
+<?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-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+
+/**
+ * ZF
+ *
+ * @category Zend
+ * @package Zend_Tool
+ * @subpackage Framework
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class ZF
+{
+
+ /**
+ * @var bool
+ */
+ protected $_clientLoaded = false;
+
+ /**
+ * @var string
+ */
+ protected $_mode = 'runTool';
+
+ /**
+ * @var array of messages
+ */
+ protected $_messages = array();
+
+ /**
+ * @var string
+ */
+ protected $_homeDirectory = null;
+
+ /**
+ * @var string
+ */
+ protected $_storageDirectory = null;
+
+ /**
+ * @var string
+ */
+ protected $_configFile = null;
+
+ /**
+ * main()
+ *
+ * @return void
+ */
+ public static function main()
+ {
+ $zf = new self();
+ $zf->bootstrap();
+ $zf->run();
+ }
+
+ /**
+ * bootstrap()
+ *
+ * @return ZF
+ */
+ public function bootstrap()
+ {
+ // detect settings
+ $this->_mode = $this->_detectMode();
+ $this->_homeDirectory = $this->_detectHomeDirectory();
+ $this->_storageDirectory = $this->_detectStorageDirectory();
+ $this->_configFile = $this->_detectConfigFile();
+
+ // setup
+ $this->_setupPHPRuntime();
+ $this->_setupToolRuntime();
+ }
+
+ /**
+ * run()
+ *
+ * @return ZF
+ */
+ public function run()
+ {
+ switch ($this->_mode) {
+ case 'runError':
+ $this->_runError();
+ $this->_runInfo();
+ break;
+ case 'runSetup':
+ if ($this->_runSetup() === false) {
+ $this->_runInfo();
+ }
+ break;
+ case 'runInfo':
+ $this->_runInfo();
+ break;
+ case 'runTool':
+ default:
+ $this->_runTool();
+ break;
+ }
+
+ return $this;
+ }
+
+ /**
+ * _detectMode()
+ *
+ * @return ZF
+ */
+ protected function _detectMode()
+ {
+ $arguments = $_SERVER['argv'];
+
+ $mode = 'runTool';
+
+ if (!isset($arguments[0])) {
+ return $mode;
+ }
+
+ if ($arguments[0] == $_SERVER['PHP_SELF']) {
+ $this->_executable = array_shift($arguments);
+ }
+
+ if (!isset($arguments[0])) {
+ return $mode;
+ }
+
+ if ($arguments[0] == '--setup') {
+ $mode = 'runSetup';
+ } elseif ($arguments[0] == '--info') {
+ $mode = 'runInfo';
+ }
+
+ return $mode;
+ }
+
+
+ /**
+ * _detectHomeDirectory() - detect the home directory in a variety of different places
+ *
+ * @param $mustExist Should the returned value already exist in the file system
+ * @param $returnMessages Should it log messages for output later
+ * @return string
+ */
+ protected function _detectHomeDirectory($mustExist = true, $returnMessages = true)
+ {
+ $homeDirectory = null;
+
+ $homeDirectory = getenv('ZF_HOME'); // check env var ZF_HOME
+ if ($homeDirectory) {
+ $this->_logMessage('Home directory found in environment variable ZF_HOME with value ' . $homeDirectory, $returnMessages);
+ if (!$mustExist || ($mustExist && file_exists($homeDirectory))) {
+ return $homeDirectory;
+ } else {
+ $this->_logMessage('Home directory does not exist at ' . $homeDirectory, $returnMessages);
+ }
+ }
+
+ $homeDirectory = getenv('HOME'); // HOME environment variable
+
+ if ($homeDirectory) {
+ $this->_logMessage('Home directory found in environment variable HOME with value ' . $homeDirectory, $returnMessages);
+ if (!$mustExist || ($mustExist && file_exists($homeDirectory))) {
+ return $homeDirectory;
+ } else {
+ $this->_logMessage('Home directory does not exist at ' . $homeDirectory, $returnMessages);
+ }
+
+ }
+
+ $homeDirectory = getenv('HOMEPATH');
+
+ if ($homeDirectory) {
+ $this->_logMessage('Home directory found in environment variable HOMEPATH with value ' . $homeDirectory, $returnMessages);
+ if (!$mustExist || ($mustExist && file_exists($homeDirectory))) {
+ return $homeDirectory;
+ } else {
+ $this->_logMessage('Home directory does not exist at ' . $homeDirectory, $returnMessages);
+ }
+ }
+
+ $homeDirectory = getenv('USERPROFILE');
+
+ if ($homeDirectory) {
+ $this->_logMessage('Home directory found in environment variable USERPROFILE with value ' . $homeDirectory, $returnMessages);
+ if (!$mustExist || ($mustExist && file_exists($homeDirectory))) {
+ return $homeDirectory;
+ } else {
+ $this->_logMessage('Home directory does not exist at ' . $homeDirectory, $returnMessages);
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * _detectStorageDirectory() - Detect where the storage directory is from a variaty of possiblities
+ *
+ * @param $mustExist Should the returned value already exist in the file system
+ * @param $returnMessages Should it log messages for output later
+ * @return string
+ */
+ protected function _detectStorageDirectory($mustExist = true, $returnMessages = true)
+ {
+ $storageDirectory = false;
+
+ $storageDirectory = getenv('ZF_STORAGE_DIR');
+ if ($storageDirectory) {
+ $this->_logMessage('Storage directory path found in environment variable ZF_STORAGE_DIR with value ' . $storageDirectory, $returnMessages);
+ if (!$mustExist || ($mustExist && file_exists($storageDirectory))) {
+ return $storageDirectory;
+ } else {
+ $this->_logMessage('Storage directory does not exist at ' . $storageDirectory, $returnMessages);
+ }
+ }
+
+ $homeDirectory = ($this->_homeDirectory) ? $this->_homeDirectory : $this->_detectHomeDirectory(true, false);
+
+ if ($homeDirectory) {
+ $storageDirectory = $homeDirectory . '/.zf/';
+ $this->_logMessage('Storage directory assumed in home directory at location ' . $storageDirectory, $returnMessages);
+ if (!$mustExist || ($mustExist && file_exists($storageDirectory))) {
+ return $storageDirectory;
+ } else {
+ $this->_logMessage('Storage directory does not exist at ' . $storageDirectory, $returnMessages);
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * _detectConfigFile() - Detect config file location from a variety of possibilities
+ *
+ * @param $mustExist Should the returned value already exist in the file system
+ * @param $returnMessages Should it log messages for output later
+ * @return string
+ */
+ protected function _detectConfigFile($mustExist = true, $returnMessages = true)
+ {
+ $configFile = null;
+
+ $configFile = getenv('ZF_CONFIG_FILE');
+ if ($configFile) {
+ $this->_logMessage('Config file found environment variable ZF_CONFIG_FILE at ' . $configFile, $returnMessages);
+ if (!$mustExist || ($mustExist && file_exists($configFile))) {
+ return $configFile;
+ } else {
+ $this->_logMessage('Config file does not exist at ' . $configFile, $returnMessages);
+ }
+ }
+
+ $homeDirectory = ($this->_homeDirectory) ? $this->_homeDirectory : $this->_detectHomeDirectory(true, false);
+ if ($homeDirectory) {
+ $configFile = $homeDirectory . '/.zf.ini';
+ $this->_logMessage('Config file assumed in home directory at location ' . $configFile, $returnMessages);
+ if (!$mustExist || ($mustExist && file_exists($configFile))) {
+ return $configFile;
+ } else {
+ $this->_logMessage('Config file does not exist at ' . $configFile, $returnMessages);
+ }
+ }
+
+ $storageDirectory = ($this->_storageDirectory) ? $this->_storageDirectory : $this->_detectStorageDirectory(true, false);
+ if ($storageDirectory) {
+ $configFile = $storageDirectory . '/zf.ini';
+ $this->_logMessage('Config file assumed in storage directory at location ' . $configFile, $returnMessages);
+ if (!$mustExist || ($mustExist && file_exists($configFile))) {
+ return $configFile;
+ } else {
+ $this->_logMessage('Config file does not exist at ' . $configFile, $returnMessages);
+ }
+ }
+
+ return false;
+ }
+
+
+ /**
+ * _setupPHPRuntime() - parse the config file if it exists for php ini values to set
+ *
+ * @return void
+ */
+ protected function _setupPHPRuntime()
+ {
+ // set php runtime settings
+ ini_set('display_errors', true);
+
+ // support the changing of the current working directory, necessary for some providers
+ if (isset($_ENV['ZEND_TOOL_CURRENT_WORKING_DIRECTORY'])) {
+ chdir($_ENV['ZEND_TOOL_CURRENT_WORKING_DIRECTORY']);
+ }
+
+ if (!$this->_configFile) {
+ return;
+ }
+ $zfINISettings = parse_ini_file($this->_configFile);
+ $phpINISettings = ini_get_all();
+ foreach ($zfINISettings as $zfINIKey => $zfINIValue) {
+ if (substr($zfINIKey, 0, 4) === 'php.') {
+ $phpINIKey = substr($zfINIKey, 4);
+ if (array_key_exists($phpINIKey, $phpINISettings)) {
+ ini_set($phpINIKey, $zfINIValue);
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * _setupToolRuntime() - setup the tools include_path and load the proper framwork parts that
+ * enable Zend_Tool to work.
+ *
+ * @return void
+ */
+ protected function _setupToolRuntime()
+ {
+
+ $includePathPrepend = getenv('ZEND_TOOL_INCLUDE_PATH_PREPEND');
+ $includePathFull = getenv('ZEND_TOOL_INCLUDE_PATH');
+
+ // check if the user has not provided anything
+ if (!($includePathPrepend || $includePathFull)) {
+ if ($this->_tryClientLoad()) {
+ return;
+ }
+ }
+
+ // if ZF is not in the include_path, but relative to this file, put it in the include_path
+ if ($includePathPrepend || $includePathFull) {
+ if (isset($includePathPrepend) && ($includePathPrepend !== false)) {
+ set_include_path($includePathPrepend . PATH_SEPARATOR . get_include_path());
+ } elseif (isset($includePathFull) && ($includePathFull !== false)) {
+ set_include_path($includePathFull);
+ }
+ }
+
+ if ($this->_tryClientLoad()) {
+ return;
+ }
+
+ $zfIncludePath['relativePath'] = dirname(__FILE__) . '/../library/';
+ if (file_exists($zfIncludePath['relativePath'] . 'Zend/Tool/Framework/Client/Console.php')) {
+ set_include_path(realpath($zfIncludePath['relativePath']) . PATH_SEPARATOR . get_include_path());
+ }
+
+ if (!$this->_tryClientLoad()) {
+ $this->_mode = 'runError';
+ return;
+ }
+
+ return null;
+ }
+
+ /**
+ * _tryClientLoad() - Attempt to load the Zend_Tool_Framework_Client_Console to enable the tool to run.
+ *
+ * This method will return false if its not loaded to allow the consumer to alter the environment in such
+ * a way that it can be called again to try loading the proper file/class.
+ *
+ * @return bool if the client is actuall loaded or not
+ */
+ protected function _tryClientLoad()
+ {
+ $this->_clientLoaded = false;
+ $fh = @fopen('Zend/Tool/Framework/Client/Console.php', 'r', true);
+ if (!$fh) {
+ return $this->_clientLoaded; // false
+ } else {
+ fclose($fh);
+ unset($fh);
+ include 'Zend/Tool/Framework/Client/Console.php';
+ $this->_clientLoaded = class_exists('Zend_Tool_Framework_Client_Console');
+ }
+
+ return $this->_clientLoaded;
+ }
+
+ /**
+ * _runError() - Output the error screen that tells the user that the tool was not setup
+ * in a sane way
+ *
+ * @return void
+ */
+ protected function _runError()
+ {
+
+ echo <<<EOS
+
+***************************** ZF ERROR ********************************
+In order to run the zf command, you need to ensure that Zend Framework
+is inside your include_path. There are a variety of ways that you can
+ensure that this zf command line tool knows where the Zend Framework
+library is on your system, but not all of them can be described here.
+
+The easiest way to get the zf command running is to allow is to give it
+the include path via an environment variable ZEND_TOOL_INCLUDE_PATH or
+ZEND_TOOL_INCLUDE_PATH_PREPEND with the proper include path to use,
+then run the command "zf --setup". This command is designed to create
+a storage location for your user, as well as create the zf.ini file
+that the zf command will consult in order to run properly on your
+system.
+
+Example you would run:
+
+$ ZEND_TOOL_INCLUDE_PATH=/path/to/library zf --setup
+
+Your are encourged to read more in the link that follows.
+
+EOS;
+
+ return null;
+ }
+
+ /**
+ * _runInfo() - this command will produce information about the setup of this script and
+ * Zend_Tool
+ *
+ * @return void
+ */
+ protected function _runInfo()
+ {
+ echo 'Zend_Tool & CLI Setup Information' . PHP_EOL
+ . '(available via the command line "zf --info")'
+ . PHP_EOL;
+
+ echo ' * ' . implode(PHP_EOL . ' * ', $this->_messages) . PHP_EOL;
+
+ echo PHP_EOL;
+
+ echo 'To change the setup of this tool, run: "zf --setup"';
+
+ echo PHP_EOL;
+
+ }
+
+ /**
+ * _runSetup() - parse the request to see which setup command to run
+ *
+ * @return void
+ */
+ protected function _runSetup()
+ {
+ $setupCommand = (isset($_SERVER['argv'][2])) ? $_SERVER['argv'][2] : null;
+
+ switch ($setupCommand) {
+ case 'storage-directory':
+ $this->_runSetupStorageDirectory();
+ break;
+ case 'config-file':
+ $this->_runSetupConfigFile();
+ break;
+ default:
+ $this->_runSetupMoreInfo();
+ break;
+ }
+
+ return null;
+ }
+
+ /**
+ * _runSetupStorageDirectory() - if the storage directory does not exist, create it
+ *
+ * @return void
+ */
+ protected function _runSetupStorageDirectory()
+ {
+ $storageDirectory = $this->_detectStorageDirectory(false, false);
+
+ if (file_exists($storageDirectory)) {
+ echo 'Directory already exists at ' . $storageDirectory . PHP_EOL
+ . 'Cannot create storage directory.';
+ return;
+ }
+
+ mkdir($storageDirectory);
+
+ echo 'Storage directory created at ' . $storageDirectory . PHP_EOL;
+ }
+
+ /**
+ * _runSetupConfigFile()
+ *
+ * @return void
+ */
+ protected function _runSetupConfigFile()
+ {
+ $configFile = $this->_detectConfigFile(false, false);
+
+ if (file_exists($configFile)) {
+ echo 'File already exists at ' . $configFile . PHP_EOL
+ . 'Cannot write new config file.';
+ return;
+ }
+
+ $includePath = get_include_path();
+
+ $contents = 'php.include_path = "' . $includePath . '"';
+
+ file_put_contents($configFile, $contents);
+
+ $iniValues = ini_get_all();
+ if ($iniValues['include_path']['global_value'] != $iniValues['include_path']['local_value']) {
+ echo 'NOTE: the php include_path to be used with the tool has been written' . PHP_EOL
+ . 'to the config file, using ZF_INCLUDE_PATH (or other include_path setters)' . PHP_EOL
+ . 'is no longer necessary.' . PHP_EOL . PHP_EOL;
+ }
+
+ echo 'Config file written to ' . $configFile . PHP_EOL;
+
+ return null;
+ }
+
+ /**
+ * _runSetupMoreInfo() - return more information about what can be setup, and what is setup
+ *
+ * @return void
+ */
+ protected function _runSetupMoreInfo()
+ {
+ $homeDirectory = $this->_detectHomeDirectory(false, false);
+ $storageDirectory = $this->_detectStorageDirectory(false, false);
+ $configFile = $this->_detectConfigFile(false, false);
+
+ echo <<<EOS
+
+ZF Command Line Tool - Setup
+----------------------------
+
+Current Paths (Existing or not):
+ Home Directory: {$homeDirectory}
+ Storage Directory: {$storageDirectory}
+ Config File: {$configFile}
+
+Important Environment Variables:
+ ZF_HOME
+ - the directory this tool will look for a home directory
+ - directory must exist
+ ZF_STORAGE_DIRECTORY
+ - where this tool will look for a storage directory
+ - directory must exist
+ ZF_CONFIG_FILE
+ - where this tool will look for a configuration file
+ ZF_INCLUDE_PATH
+ - set the include_path for this tool to use this value
+ ZF_INCLUDE_PATH_PREPEND
+ - prepend the current php.ini include_path with this value
+
+Search Order:
+ Home Directory:
+ - ZF_HOME, then HOME (*nix), then HOMEPATH (windows)
+ Storage Directory:
+ - ZF_STORAGE_DIR, then {home}/.zf/
+ Config File:
+ - ZF_CONFIG_FILE, then {home}/.zf.ini, then {home}/zf.ini,
+ then {storage}/zf.ini
+
+Commands:
+ zf --setup storage-directory
+ - setup the storage directory, directory will be created
+ zf --setup config-file
+ - create the config file with some default values
+
+
+EOS;
+ }
+
+ /**
+ * _runTool() - This is where the magic happens, dispatch Zend_Tool
+ *
+ * @return void
+ */
+ protected function _runTool()
+ {
+
+ $configOptions = array();
+ if (isset($this->_configFile) && $this->_configFile) {
+ $configOptions['configOptions']['configFilepath'] = $this->_configFile;
+ }
+ if (isset($this->_storageDirectory) && $this->_storageDirectory) {
+ $configOptions['storageOptions']['directory'] = $this->_storageDirectory;
+ }
+
+ // ensure that zf.php loads the Zend_Tool_Project features
+ $configOptions['classesToLoad'] = 'Zend_Tool_Project_Provider_Manifest';
+
+ $console = new Zend_Tool_Framework_Client_Console($configOptions);
+ $console->dispatch();
+ return null;
+ }
+
+ /**
+ * _logMessage() - Internal method used to log setup and information messages.
+ *
+ * @param $message
+ * @param $storeMessage
+ * @return void
+ */
+ protected function _logMessage($message, $storeMessage = true)
+ {
+ if (!$storeMessage) {
+ return;
+ }
+
+ $this->_messages[] = $message;
+ }
+
+
+}
+
+if (!getenv('ZF_NO_MAIN')) {
+ ZF::main();
+}
+
+
45 bin/zf.sh
@@ -0,0 +1,45 @@
+#!/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-2010 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-2010 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-2010 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-2010 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 = explode('-', $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 = explode('-', $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 = explode('/', $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 = explode('=', $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-2010 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-2010 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-2010 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.
+ *