Index: branches/version-2_13_0/data/module/Calendar/Calendar.php
===================================================================
--- branches/version-2_13_0/data/module/Calendar/Calendar.php	(revision 23126)
+++ branches/version-2_13_0/data/module/Calendar/Calendar.php	(revision 23143)
@@ -1,39 +1,27 @@
 <?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/3_0.txt.                                  |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Harry Fuecks <hfuecks@phppatterns.com>                      |
+// |          Lorenzo Alberton <l dot alberton at quipo dot it>           |
+// +----------------------------------------------------------------------+
+//
+// $Id: Calendar.php,v 1.3 2005/10/22 10:07:11 quipo Exp $
+//
 /**
- * Contains the Calendar and Calendar_Engine_Factory classes
- *
- * PHP versions 4 and 5
- *
- * LICENSE: Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "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 FREEBSD PROJECT 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.
- *
- * @category  Date and Time
- * @package   Calendar
- * @author    Harry Fuecks <hfuecks@phppatterns.com>
- * @author    Lorenzo Alberton <l.alberton@quipo.it>
- * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
- * @license   http://www.debian.org/misc/bsd.license  BSD License (3 Clause)
- * @version   CVS: $Id: Calendar.php 300729 2010-06-24 12:05:53Z quipo $
- * @link      http://pear.php.net/package/Calendar
+ * @package Calendar
+ * @version $Id: Calendar.php,v 1.3 2005/10/22 10:07:11 quipo Exp $
  */
 
@@ -65,14 +53,7 @@
  * Calendar_Engines. The engine used can be controlled with the constant
  * CALENDAR_ENGINE
- *
- * @category  Date and Time
- * @package   Calendar
- * @author    Harry Fuecks <hfuecks@phppatterns.com>
- * @author    Lorenzo Alberton <l.alberton@quipo.it>
- * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
- * @license   http://www.debian.org/misc/bsd.license  BSD License (3 Clause)
- * @link      http://pear.php.net/package/Calendar
- * @see       Calendar_Engine_Interface
- * @access    protected
+ * @see Calendar_Engine_Interface
+ * @package Calendar
+ * @access protected
  */
 class Calendar_Engine_Factory
@@ -80,5 +61,4 @@
     /**
      * Returns an instance of the engine
-     *
      * @return object instance of a calendar calculation engine
      * @access protected
@@ -88,15 +68,15 @@
         static $engine = false;
         switch (CALENDAR_ENGINE) {
-        case 'PearDate':
-            $class = 'Calendar_Engine_PearDate';
-            break;
-        case 'UnixTS':
-        default:
-            $class = 'Calendar_Engine_UnixTS';
+            case 'PearDate':
+                $class = 'Calendar_Engine_PearDate';
+                break;
+            case 'UnixTS':
+            default:
+                $class = 'Calendar_Engine_UnixTS';
             break;
         }
         if (!$engine) {
             if (!class_exists($class)) {
-                include_once CALENDAR_ROOT.'Engine'.DIRECTORY_SEPARATOR.CALENDAR_ENGINE.'.php';
+                require_once CALENDAR_ROOT.'Engine'.DIRECTORY_SEPARATOR.CALENDAR_ENGINE.'.php';
             }
             $engine = new $class;
@@ -107,14 +87,8 @@
 
 /**
- * Base class for Calendar API. This class should not be instantiated directly.
- *
- * @category  Date and Time
- * @package   Calendar
- * @author    Harry Fuecks <hfuecks@phppatterns.com>
- * @author    Lorenzo Alberton <l.alberton@quipo.it>
- * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
- * @license   http://www.debian.org/misc/bsd.license  BSD License (3 Clause)
- * @link      http://pear.php.net/package/Calendar
+ * Base class for Calendar API. This class should not be instantiated
+ * directly.
  * @abstract
+ * @package Calendar
  */
 class Calendar
@@ -140,5 +114,5 @@
      * @var int
      */
-    var $year;
+   var $year;
 
     /**
@@ -194,12 +168,10 @@
     /**
      * Constructs the Calendar
-     *
-     * @param int $y year
-     * @param int $m month
-     * @param int $d day
-     * @param int $h hour
-     * @param int $i minute
-     * @param int $s second
-     *
+     * @param int year
+     * @param int month
+     * @param int day
+     * @param int hour
+     * @param int minute
+     * @param int second
      * @access protected
      */
@@ -210,5 +182,5 @@
             $cE = & Calendar_Engine_Factory::getEngine();
         }
-        $this->cE     = & $cE;
+        $this->cE = & $cE;
         $this->year   = (int)$y;
         $this->month  = (int)$m;
@@ -222,7 +194,5 @@
      * Defines the calendar by a timestamp (Unix or ISO-8601), replacing values
      * passed to the constructor
-     *
-     * @param int|string $ts Unix or ISO-8601 timestamp
-     *
+     * @param int|string Unix or ISO-8601 timestamp
      * @return void
      * @access public
@@ -241,5 +211,4 @@
      * Returns a timestamp from the current date / time values. Format of
      * timestamp depends on Calendar_Engine implementation being used
-     *
      * @return int|string timestamp
      * @access public
@@ -254,7 +223,5 @@
     /**
      * Defines calendar object as selected (e.g. for today)
-     *
-     * @param boolean $state whether Calendar subclass
-     *
+     * @param boolean state whether Calendar subclass
      * @return void
      * @access public
@@ -267,5 +234,4 @@
     /**
      * True if the calendar subclass object is selected (e.g. today)
-     *
      * @return boolean
      * @access public
@@ -277,17 +243,5 @@
 
     /**
-     * Checks if the current Calendar object is today's date
-     *
-     * @return boolean
-     * @access public
-     */
-    function isToday()
-    {
-        return $this->cE->isToday($this->getTimeStamp());
-    }
-
-    /**
      * Adjusts the date (helper method)
-     *
      * @return void
      * @access public
@@ -295,5 +249,5 @@
     function adjust()
     {
-        $stamp        = $this->getTimeStamp();
+        $stamp = $this->getTimeStamp();
         $this->year   = $this->cE->stampToYear($stamp);
         $this->month  = $this->cE->stampToMonth($stamp);
@@ -306,7 +260,5 @@
     /**
      * Returns the date as an associative array (helper method)
-     *
-     * @param mixed $stamp timestamp (leave empty for current timestamp)
-     *
+     * @param mixed timestamp (leave empty for current timestamp)
      * @return array
      * @access public
@@ -329,10 +281,8 @@
     /**
      * Returns the value as an associative array (helper method)
-     *
-     * @param string $returnType type of date object that return value represents
-     * @param string $format     ['int' | 'array' | 'timestamp' | 'object']
-     * @param mixed  $stamp      timestamp (depending on Calendar engine being used)
-     * @param int    $default    default value (i.e. give me the answer quick)
-     *
+     * @param string type of date object that return value represents
+     * @param string $format ['int' | 'array' | 'timestamp' | 'object']
+     * @param mixed timestamp (depending on Calendar engine being used)
+     * @param int integer default value (i.e. give me the answer quick)
      * @return mixed
      * @access private
@@ -341,17 +291,17 @@
     {
         switch (strtolower($format)) {
-        case 'int':
-            return $default;
-        case 'array':
-            return $this->toArray($stamp);
-            break;
-        case 'object':
-            include_once CALENDAR_ROOT.'Factory.php';
-            return Calendar_Factory::createByTimestamp($returnType, $stamp);
-            break;
-        case 'timestamp':
-        default:
-            return $stamp;
-            break;
+            case 'int':
+                return $default;
+            case 'array':
+                return $this->toArray($stamp);
+                break;
+            case 'object':
+                require_once CALENDAR_ROOT.'Factory.php';
+                return Calendar_Factory::createByTimestamp($returnType,$stamp);
+                break;
+            case 'timestamp':
+            default:
+                return $stamp;
+                break;
         }
     }
@@ -360,7 +310,5 @@
      * Abstract method for building the children of a calendar object.
      * Implemented by Calendar subclasses
-     *
-     * @param array $sDates array containing Calendar objects to select (optional)
-     *
+     * @param array containing Calendar objects to select (optional)
      * @return boolean
      * @access public
@@ -369,6 +317,7 @@
     function build($sDates = array())
     {
-        include_once 'PEAR.php';
-        PEAR::raiseError('Calendar::build is abstract', null, PEAR_ERROR_TRIGGER,
+        require_once 'PEAR.php';
+        PEAR::raiseError(
+            'Calendar::build is abstract', null, PEAR_ERROR_TRIGGER,
             E_USER_NOTICE, 'Calendar::build()');
         return false;
@@ -377,7 +326,5 @@
     /**
      * Abstract method for selected data objects called from build
-     *
-     * @param array $sDates array of Calendar objects to select
-     *
+     * @param array
      * @return boolean
      * @access public
@@ -386,5 +333,5 @@
     function setSelection($sDates)
     {
-        include_once 'PEAR.php';
+        require_once 'PEAR.php';
         PEAR::raiseError(
             'Calendar::setSelection is abstract', null, PEAR_ERROR_TRIGGER,
@@ -398,5 +345,4 @@
      * the collection, returns false and resets the collection for
      * further iteratations.
-     *
      * @return mixed either an object subclass of Calendar or false
      * @access public
@@ -415,5 +361,4 @@
     /**
      * Fetches all child from the current collection of children
-     *
      * @return array
      * @access public
@@ -425,6 +370,6 @@
 
     /**
-     * Get the number Calendar subclass objects stored in the internal collection
-     *
+     * Get the number Calendar subclass objects stored in the internal
+     * collection.
      * @return int
      * @access public
@@ -437,6 +382,6 @@
     /**
      * Determine whether this date is valid, with the bounds determined by
-     * the Calendar_Engine. The call is passed on to Calendar_Validator::isValid
-     *
+     * the Calendar_Engine. The call is passed on to
+     * Calendar_Validator::isValid
      * @return boolean
      * @access public
@@ -450,5 +395,4 @@
     /**
      * Returns an instance of Calendar_Validator
-     *
      * @return Calendar_Validator
      * @access public
@@ -457,6 +401,6 @@
     {
         if (!isset($this->validator)) {
-            include_once CALENDAR_ROOT.'Validator.php';
-            $this->validator = new Calendar_Validator($this);
+            require_once CALENDAR_ROOT.'Validator.php';
+            $this->validator = & new Calendar_Validator($this);
         }
         return $this->validator;
@@ -466,5 +410,4 @@
      * Returns a reference to the current Calendar_Engine being used. Useful
      * for Calendar_Table_Helper and Calendar_Validator
-     *
      * @return object implementing Calendar_Engine_Inteface
      * @access protected
@@ -478,11 +421,9 @@
      * Set the CALENDAR_FIRST_DAY_OF_WEEK constant to the $firstDay value
      * if the constant is not set yet.
-     *
-     * @param integer $firstDay first day of the week (0=sunday, 1=monday, ...)
-     *
-     * @return integer
      * @throws E_USER_WARNING this method throws a WARNING if the
      *    CALENDAR_FIRST_DAY_OF_WEEK constant is already defined and
      *    the $firstDay parameter is set to a different value
+     * @param integer $firstDay first day of the week (0=sunday, 1=monday, ...)
+     * @return integer
      * @access protected
      */
@@ -510,7 +451,5 @@
     /**
      * Returns the value for the previous year
-     *
-     * @param string $format return value format ['int'|'timestamp'|'object'|'array']
-     *
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
      * @return int e.g. 2002 or timestamp
      * @access public
@@ -524,7 +463,5 @@
     /**
      * Returns the value for this year
-     *
-     * @param string $format return value format ['int'|'timestamp'|'object'|'array']
-     *
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
      * @return int e.g. 2003 or timestamp
      * @access public
@@ -538,7 +475,5 @@
     /**
      * Returns the value for next year
-     *
-     * @param string $format return value format ['int'|'timestamp'|'object'|'array']
-     *
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
      * @return int e.g. 2004 or timestamp
      * @access public
@@ -552,7 +487,5 @@
     /**
      * Returns the value for the previous month
-     *
-     * @param string $format return value format ['int'|'timestamp'|'object'|'array']
-     *
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
      * @return int e.g. 4 or Unix timestamp
      * @access public
@@ -566,7 +499,5 @@
     /**
      * Returns the value for this month
-     *
-     * @param string $format return value format ['int'|'timestamp'|'object'|'array']
-     *
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
      * @return int e.g. 5 or timestamp
      * @access public
@@ -580,7 +511,5 @@
     /**
      * Returns the value for next month
-     *
-     * @param string $format return value format ['int'|'timestamp'|'object'|'array']
-     *
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
      * @return int e.g. 6 or timestamp
      * @access public
@@ -594,7 +523,5 @@
     /**
      * Returns the value for the previous day
-     *
-     * @param string $format return value format ['int'|'timestamp'|'object'|'array']
-     *
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
      * @return int e.g. 10 or timestamp
      * @access public
@@ -609,7 +536,5 @@
     /**
      * Returns the value for this day
-     *
-     * @param string $format return value format ['int'|'timestamp'|'object'|'array']
-     *
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
      * @return int e.g. 11 or timestamp
      * @access public
@@ -624,7 +549,5 @@
     /**
      * Returns the value for the next day
-     *
-     * @param string $format return value format ['int'|'timestamp'|'object'|'array']
-     *
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
      * @return int e.g. 12 or timestamp
      * @access public
@@ -639,7 +562,5 @@
     /**
      * Returns the value for the previous hour
-     *
-     * @param string $format return value format ['int'|'timestamp'|'object'|'array']
-     *
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
      * @return int e.g. 13 or timestamp
      * @access public
@@ -654,7 +575,5 @@
     /**
      * Returns the value for this hour
-     *
-     * @param string $format return value format ['int'|'timestamp'|'object'|'array']
-     *
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
      * @return int e.g. 14 or timestamp
      * @access public
@@ -669,7 +588,5 @@
     /**
      * Returns the value for the next hour
-     *
-     * @param string $format return value format ['int'|'timestamp'|'object'|'array']
-     *
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
      * @return int e.g. 14 or timestamp
      * @access public
@@ -684,7 +601,5 @@
     /**
      * Returns the value for the previous minute
-     *
-     * @param string $format return value format ['int'|'timestamp'|'object'|'array']
-     *
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
      * @return int e.g. 23 or timestamp
      * @access public
@@ -700,7 +615,5 @@
     /**
      * Returns the value for this minute
-     *
-     * @param string $format return value format ['int'|'timestamp'|'object'|'array']
-     *
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
      * @return int e.g. 24 or timestamp
      * @access public
@@ -716,7 +629,5 @@
     /**
     * Returns the value for the next minute
-    *
-     * @param string $format return value format ['int'|'timestamp'|'object'|'array']
-     *
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
      * @return int e.g. 25 or timestamp
      * @access public
@@ -732,7 +643,5 @@
     /**
      * Returns the value for the previous second
-     *
-     * @param string $format return value format ['int'|'timestamp'|'object'|'array']
-     *
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
      * @return int e.g. 43 or timestamp
      * @access public
@@ -748,7 +657,5 @@
     /**
      * Returns the value for this second
-     *
-    * @param string $format return value format ['int'|'timestamp'|'object'|'array']
-    *
+    * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
      * @return int e.g. 44 or timestamp
      * @access public
@@ -764,7 +671,5 @@
     /**
      * Returns the value for the next second
-     *
-     * @param string $format return value format ['int'|'timestamp'|'object'|'array']
-     *
+     * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
      * @return int e.g. 45 or timestamp
      * @access public
