From 7d262ad50b399b55e3a25636456de8a3034de009 Mon Sep 17 00:00:00 2001 From: Diogo Cordeiro Date: Mon, 15 Jul 2019 01:40:09 +0100 Subject: [PATCH] [CORE] Fixed some small issues with PEAR --- Makefile | 3 + composer.json | 1 + composer.lock | 49 +- extlib/Date.php | 6672 --------------- extlib/Date/Calc.php | 4728 ----------- extlib/Date/Human.php | 242 - extlib/Date/Span.php | 1181 --- extlib/Date/TimeZone.php | 7402 ----------------- extlib/Date/docs/LICENSE | 30 - extlib/Date/docs/TODO | 12 - extlib/Date/docs/examples/example.php | 137 - extlib/Date/tests/DateSpanTest.php | 225 - extlib/Date/tests/DateTest.php | 453 - extlib/Date/tests/bugs/bug-11313.phpt | 65 - extlib/Date/tests/bugs/bug-13376.phpt | 32 - extlib/Date/tests/bugs/bug-13545.phpt | 13 - extlib/Date/tests/bugs/bug-19568.phpt | 22 - extlib/Date/tests/bugs/bug-2378-1.phpt | 17 - extlib/Date/tests/bugs/bug-2378.phpt | 104 - extlib/Date/tests/bugs/bug-445.phpt | 22 - extlib/Date/tests/bugs/bug-6246.phpt | 104 - extlib/Date/tests/bugs/bug-674.phpt | 34 - extlib/Date/tests/bugs/bug-727-1.phpt | 52 - extlib/Date/tests/bugs/bug-727-2.phpt | 52 - extlib/Date/tests/bugs/bug-727-3.phpt | 500 -- extlib/Date/tests/bugs/bug-727-4.phpt | 500 -- extlib/Date/tests/bugs/bug-8518.phpt | 21 - extlib/Date/tests/bugs/bug-8912.phpt | 88 - extlib/Date/tests/bugs/bug-9213.phpt | 22 - extlib/Date/tests/bugs/bug-9414.phpt | 26 - extlib/Date/tests/bugs/bug-9568.phpt | 99 - extlib/Date/tests/bugs/bug-967.phpt | 27 - extlib/Date/tests/bugs/bug-9801.phpt | 27 - extlib/Date/tests/calc.php | 408 - extlib/Date/tests/test_addseconds.php | 447 - .../Date/tests/test_addseconds_Calcutta.php | 447 - extlib/Date/tests/test_addseconds_Paris.php | 447 - extlib/Date/tests/test_calc.php | 50 - extlib/Date/tests/test_date_methods_span.php | 68 - extlib/Date/tests/test_format.php | 526 -- extlib/Date/tests/test_julianday.php | 4504 ---------- extlib/Date/tests/test_round_trunc.php | 231 - extlib/Date/tests/test_weeknumbers_0.php | 3527 -------- extlib/Date/tests/test_weeknumbers_1.php | 3527 -------- extlib/Date/tests/test_weeknumbers_2.php | 3527 -------- extlib/Date/tests/test_weeknumbers_3.php | 3527 -------- extlib/Date/tests/test_weeknumbers_4.php | 3527 -------- extlib/Date/tests/test_weeknumbers_5.php | 3527 -------- extlib/Date/tests/test_weeknumbers_6.php | 3527 -------- extlib/Date/tests/test_weeknumbers_ISO.php | 1934 ----- extlib/PEAR.php | 838 +- extlib/PEAR/ErrorStack.php | 199 +- extlib/PEAR/Exception.php | 246 +- extlib/PEAR_LICENSE | 27 + extlib/System.php | 616 +- extlib/Validate.php | 213 - extlib/Validate_LICENSE | 22 + scripts/command.php | 4 +- scripts/commandline.inc | 10 +- scripts/docgen.php | 4 +- vendor/composer/autoload_classmap.php | 1 + vendor/composer/autoload_namespaces.php | 1 + vendor/composer/autoload_static.php | 8 + vendor/composer/include_paths.php | 1 + vendor/composer/installed.json | 49 + vendor/pear/console_getopt/.gitignore | 6 + vendor/pear/console_getopt/.travis.yml | 9 + .../pear/console_getopt}/Console/Getopt.php | 67 +- vendor/pear/console_getopt/LICENSE | 25 + vendor/pear/console_getopt/README.rst | 26 + vendor/pear/console_getopt/composer.json | 35 + vendor/pear/console_getopt/package.xml | 284 + .../pear/console_getopt/tests/001-getopt.phpt | 63 + .../pear/console_getopt/tests/bug10557.phpt | 22 + .../pear/console_getopt/tests/bug11068.phpt | 44 + .../pear/console_getopt/tests/bug13140.phpt | 75 + 76 files changed, 1736 insertions(+), 57872 deletions(-) delete mode 100644 extlib/Date.php delete mode 100644 extlib/Date/Calc.php delete mode 100644 extlib/Date/Human.php delete mode 100644 extlib/Date/Span.php delete mode 100644 extlib/Date/TimeZone.php delete mode 100644 extlib/Date/docs/LICENSE delete mode 100644 extlib/Date/docs/TODO delete mode 100644 extlib/Date/docs/examples/example.php delete mode 100644 extlib/Date/tests/DateSpanTest.php delete mode 100644 extlib/Date/tests/DateTest.php delete mode 100644 extlib/Date/tests/bugs/bug-11313.phpt delete mode 100644 extlib/Date/tests/bugs/bug-13376.phpt delete mode 100644 extlib/Date/tests/bugs/bug-13545.phpt delete mode 100644 extlib/Date/tests/bugs/bug-19568.phpt delete mode 100644 extlib/Date/tests/bugs/bug-2378-1.phpt delete mode 100644 extlib/Date/tests/bugs/bug-2378.phpt delete mode 100644 extlib/Date/tests/bugs/bug-445.phpt delete mode 100644 extlib/Date/tests/bugs/bug-6246.phpt delete mode 100644 extlib/Date/tests/bugs/bug-674.phpt delete mode 100644 extlib/Date/tests/bugs/bug-727-1.phpt delete mode 100644 extlib/Date/tests/bugs/bug-727-2.phpt delete mode 100644 extlib/Date/tests/bugs/bug-727-3.phpt delete mode 100644 extlib/Date/tests/bugs/bug-727-4.phpt delete mode 100644 extlib/Date/tests/bugs/bug-8518.phpt delete mode 100644 extlib/Date/tests/bugs/bug-8912.phpt delete mode 100644 extlib/Date/tests/bugs/bug-9213.phpt delete mode 100644 extlib/Date/tests/bugs/bug-9414.phpt delete mode 100644 extlib/Date/tests/bugs/bug-9568.phpt delete mode 100644 extlib/Date/tests/bugs/bug-967.phpt delete mode 100644 extlib/Date/tests/bugs/bug-9801.phpt delete mode 100755 extlib/Date/tests/calc.php delete mode 100644 extlib/Date/tests/test_addseconds.php delete mode 100644 extlib/Date/tests/test_addseconds_Calcutta.php delete mode 100644 extlib/Date/tests/test_addseconds_Paris.php delete mode 100644 extlib/Date/tests/test_calc.php delete mode 100644 extlib/Date/tests/test_date_methods_span.php delete mode 100644 extlib/Date/tests/test_format.php delete mode 100644 extlib/Date/tests/test_julianday.php delete mode 100644 extlib/Date/tests/test_round_trunc.php delete mode 100644 extlib/Date/tests/test_weeknumbers_0.php delete mode 100644 extlib/Date/tests/test_weeknumbers_1.php delete mode 100644 extlib/Date/tests/test_weeknumbers_2.php delete mode 100644 extlib/Date/tests/test_weeknumbers_3.php delete mode 100644 extlib/Date/tests/test_weeknumbers_4.php delete mode 100644 extlib/Date/tests/test_weeknumbers_5.php delete mode 100644 extlib/Date/tests/test_weeknumbers_6.php delete mode 100644 extlib/Date/tests/test_weeknumbers_ISO.php create mode 100644 extlib/PEAR_LICENSE create mode 100644 extlib/Validate_LICENSE create mode 100644 vendor/pear/console_getopt/.gitignore create mode 100644 vendor/pear/console_getopt/.travis.yml rename {extlib => vendor/pear/console_getopt}/Console/Getopt.php (86%) create mode 100644 vendor/pear/console_getopt/LICENSE create mode 100644 vendor/pear/console_getopt/README.rst create mode 100644 vendor/pear/console_getopt/composer.json create mode 100644 vendor/pear/console_getopt/package.xml create mode 100644 vendor/pear/console_getopt/tests/001-getopt.phpt create mode 100644 vendor/pear/console_getopt/tests/bug10557.phpt create mode 100644 vendor/pear/console_getopt/tests/bug11068.phpt create mode 100644 vendor/pear/console_getopt/tests/bug13140.phpt diff --git a/Makefile b/Makefile index 6f45c1b83e..8d0a45153f 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,9 @@ plugin_mo = $(patsubst %.po,%.mo,$(wildcard plugins/*/locale/*/LC_MESSAGES/*.po) translations : $(core_mo) $(plugin_mo) +upgrade : + php scripts/upgrade.php + clean : rm -f $(core_mo) $(plugin_mo) diff --git a/composer.json b/composer.json index e69a2f96f1..6806f1ae32 100644 --- a/composer.json +++ b/composer.json @@ -25,6 +25,7 @@ "michelf/php-markdown": "^1.8.0", "openid/php-openid": "^2.3", "paragonie/constant_time_encoding": "^1.0.4", + "pear/console_getopt": "^1.4", "phpseclib/phpseclib": "dev-master#f815e43077da67d3dd5b4d18a45753f5b79c1ab9", "stomp-php/stomp-php": "^4.5.1" }, diff --git a/composer.lock b/composer.lock index 0ba40e438c..e7272a0303 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "443e1729de86d54a2d4e4707b15ad41d", + "content-hash": "f84a3a1654cf40103976cea8b2365b8c", "packages": [ { "name": "apereo/phpcas", @@ -682,6 +682,53 @@ ], "time": "2019-01-03T20:59:08+00:00" }, + { + "name": "pear/console_getopt", + "version": "v1.4.2", + "source": { + "type": "git", + "url": "https://github.com/pear/Console_Getopt.git", + "reference": "6c77aeb625b32bd752e89ee17972d103588b90c0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pear/Console_Getopt/zipball/6c77aeb625b32bd752e89ee17972d103588b90c0", + "reference": "6c77aeb625b32bd752e89ee17972d103588b90c0", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-0": { + "Console": "./" + } + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "./" + ], + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Greg Beaver", + "email": "cellog@php.net", + "role": "Helper" + }, + { + "name": "Andrei Zmievski", + "email": "andrei@php.net", + "role": "Lead" + }, + { + "name": "Stig Bakken", + "email": "stig@php.net", + "role": "Developer" + } + ], + "description": "More info available on: http://pear.php.net/package/Console_Getopt", + "time": "2019-02-06T16:52:33+00:00" + }, { "name": "phpseclib/phpseclib", "version": "dev-master", diff --git a/extlib/Date.php b/extlib/Date.php deleted file mode 100644 index 71cbe64990..0000000000 --- a/extlib/Date.php +++ /dev/null @@ -1,6672 +0,0 @@ - - * @author Pierre-Alain Joye - * @author Firman Wandayandi - * @author C.A. Woodcock - * @copyright 1997-2007 Baba Buehler, Pierre-Alain Joye, Firman Wandayandi, C.A. Woodcock - * @license http://www.opensource.org/licenses/bsd-license.php - * BSD License - * @version CVS: $Id$ - * @link http://pear.php.net/package/Date - */ - - -// }}} -// {{{ Error constants - -define('DATE_ERROR_INVALIDDATE', 1); -define('DATE_ERROR_INVALIDTIME', 2); -define('DATE_ERROR_INVALIDTIMEZONE', 3); -define('DATE_ERROR_INVALIDDATEFORMAT', 4); -define('DATE_ERROR_INVALIDFORMATSTRING', 5); - - -// }}} -// {{{ Includes - -require_once 'PEAR.php'; - -/** - * Load Date_TimeZone - */ -require_once 'Date/TimeZone.php'; - -/** - * Load Date_Calc - */ -require_once 'Date/Calc.php'; - -/** - * Load Date_Span - */ -require_once 'Date/Span.php'; - - -// }}} -// {{{ General constants - -/** - * Whether to capture the micro-time (in microseconds) by default - * in calls to {@link Date::setNow()}. Note that this makes a call to - * {@link http://www.php.net/gettimeofday gettimeofday()}, which may - * not work on all systems. - * - * @since Constant available since Release 1.5.0 - */ -define('DATE_CAPTURE_MICROTIME_BY_DEFAULT', false); - -/** - * Whether to correct, by adding the local Summer time offset, the - * specified time if it falls in the 'skipped hour' (encountered - * when the clocks go forward). - * - * N.B. if specified as 'false', and if a time zone that adjusts - * for Summer time is specified, then an object of this class will - * be set to a semi-invalid state if an invalid time is set. That - * is, an error will not be returned, unless the user then calls - * a function, directly or indirectly, that accesses the time - * part of the object. So, for example, if the user calls: - * - * $date_object->formatLikeSQL('HH.MI.SS'); - * - * or: - * - * $date_object->addSeconds(30); - * - * an error will be returned if the time is invalid. However, - * if the user calls: - * - * $date_object->addDays(1); - * - * for example, such that the time is no longer invalid, then the - * object will no longer be in this invalid state. This behaviour - * is intended to minimize unexpected errors when a user uses the - * class to do addition with days only, and does not intend to - * access the time. - * - * Of course, this constant will be unused if the user chooses to - * work in UTC or a time zone without Summer time, in which case - * this situation will never arise. - * - * This constant is set to 'true' by default for backwards-compatibility - * reasons, however, you are recommended to set it to 'false'. Note that the - * behaviour is not intended to match that of previous versions of the class - * in terms of ignoring the Summer time offset when making calculations which - * involve dates in both standard and Summer time - this was recognized as a - * bug - but in terms of returning a PEAR error object when the user sets the - * object to an invalid date (i.e. a time in the hour which is skipped when - * the clocks go forwards, which in Europe would be a time such as 01.30). - * Backwards compatibility here means that the behaviour is the same as it - * used to be, less the bug. - * - * Note that this problem is not an issue for the user if any of these - * conditions are satisfied: - * - *
    - *
  1. the user uses a time zone that does not observe Summer time, e.g. UTC
  2. - *
  3. the user never accesses the time, that is, he never makes a call to - * {@link Date::getHour()} or {@link Date::formatLikeStrftime()} using - * format code '%H', for example, even if he sets the time to - * something invalid
  4. - *
  5. the user sets DATE_CORRECTINVALIDTIME_DEFAULT to true
  6. - *
- * - * @since Constant available since Release 1.5.0 - * @see Date::isValidTime(), DATE_VALIDATE_DATE_BY_DEFAULT - */ -define('DATE_CORRECTINVALIDTIME_DEFAULT', true); - -/** - * Whether to validate dates (i.e. day/month/year, ignoring the time) by - * disallowing invalid dates (e.g. 31st February) being set by the following - * functions: - * - * - {@link Date::setYear()} - * - {@link Date::setMonth()} - * - {@link Date::setDay()} - * - * If the constant is set to 'true', then the date will be checked (by - * default), and if invalid, an error will be returned with the Date object - * left unmodified. - * - * This constant is set to 'false' by default for backwards-compatibility - * reasons, however, you are recommended to set it to 'true'. - * - * Note that {@link Date::setHour()}, {@link Date::setMinute()}, - * {@link Date::setSecond()} and {@link Date::setPartSecond()} - * allow an invalid date/time to be set regardless of the value of this - * constant. - * - * @see Date::isValidDate(), Date::isValidTime(), Date::isNull(), - * DATE_CORRECTINVALIDTIME_DEFAULT - * @since Constant available since Release 1.5.0 - */ -define('DATE_VALIDATE_DATE_BY_DEFAULT', false); - -/** - * Whether, by default, to accept times including leap seconds (i.e. '23.59.60') - * when setting the date/time, and whether to count leap seconds in the - * following functions: - * - * - {@link Date::addSeconds()} - * - {@link Date::subtractSeconds()} - * - {@link Date_Calc::addSeconds()} - * - {@link Date::round()} - * - {@link Date::roundSeconds()} - * - * This constant is set to 'false' by default for backwards-compatibility - * reasons, however, you are recommended to set it to 'true'. - * - * Note that this constant does not affect {@link Date::addSpan()} and - * {@link Date::subtractSpan()} which will not count leap seconds in any case. - * - * @since Constant available since Release 1.5.0 - */ -define('DATE_COUNT_LEAP_SECONDS', false); - -/** - * Method to call when user invokes {@link Date::format()} - * - * @since Constant available since Release 1.5.1 - */ -define('DATE_FORMAT_METHOD', 'formatLikeStrftime'); - - -// }}} -// {{{ Output format constants (used in {@link Date::getDate()}) - -/** - * "YYYY-MM-DD HH:MM:SS" - */ -define('DATE_FORMAT_ISO', 1); - -/** - * "YYYYMMDDTHHMMSS(Z|(+/-)HHMM)?" - */ -define('DATE_FORMAT_ISO_BASIC', 2); - -/** - * "YYYY-MM-DDTHH:MM:SS(Z|(+/-)HH:MM)?" - */ -define('DATE_FORMAT_ISO_EXTENDED', 3); - -/** - * "YYYY-MM-DDTHH:MM:SS(.S*)?(Z|(+/-)HH:MM)?" - */ -define('DATE_FORMAT_ISO_EXTENDED_MICROTIME', 6); - -/** - * "YYYYMMDDHHMMSS" - */ -define('DATE_FORMAT_TIMESTAMP', 4); - -/** - * long int, seconds since the unix epoch - */ -define('DATE_FORMAT_UNIXTIME', 5); - - -// }}} -// {{{ Class: Date - -/** - * Generic date handling class for PEAR - * - * Supports time zones with the Date_TimeZone class. Supports several - * operations from Date_Calc on Date objects. - * - * Note to developers: the class stores the local time and date in the - * local standard time. That is, it does not store the time as the - * local Summer time when and if the time zone is in Summer time. It - * is much easier to store local standard time and remember to offset - * it when the user requests it. - * - * @category Date and Time - * @package Date - * @author Baba Buehler - * @author Pierre-Alain Joye - * @author Firman Wandayandi - * @author C.A. Woodcock - * @copyright 1997-2007 Baba Buehler, Pierre-Alain Joye, Firman Wandayandi, C.A. Woodcock - * @license http://www.opensource.org/licenses/bsd-license.php - * BSD License - * @version Release: 1.5.0a1 - * @link http://pear.php.net/package/Date - */ -class Date -{ - - // {{{ Properties - - /** - * The year - * - * @var int - * @access private - * @since Property available since Release 1.0 - */ - public $year; - - /** - * The month - * - * @var int - * @access private - * @since Property available since Release 1.0 - */ - public $month; - - /** - * The day - * - * @var int - * @access private - * @since Property available since Release 1.0 - */ - public $day; - - /** - * The hour - * - * @var int - * @access private - * @since Property available since Release 1.0 - */ - public $hour; - - /** - * The minute - * - * @var int - * @access private - * @since Property available since Release 1.0 - */ - public $minute; - - /** - * The second - * - * @var int - * @access private - * @since Property available since Release 1.0 - */ - public $second; - - /** - * The parts of a second - * - * @var float - * @access private - * @since Property available since Release 1.4.3 - */ - public $partsecond; - - /** - * The year in local standard time - * - * @var int - * @access private - * @since Property available since Release 1.5.0 - */ - public $on_standardyear; - - /** - * The month in local standard time - * - * @var int - * @access private - * @since Property available since Release 1.5.0 - */ - public $on_standardmonth; - - /** - * The day in local standard time - * - * @var int - * @access private - * @since Property available since Release 1.5.0 - */ - public $on_standardday; - - /** - * The hour in local standard time - * - * @var int - * @access private - * @since Property available since Release 1.5.0 - */ - public $on_standardhour; - - /** - * The minute in local standard time - * - * @var int - * @access private - * @since Property available since Release 1.5.0 - */ - public $on_standardminute; - - /** - * The second in local standard time - * - * @var int - * @access private - * @since Property available since Release 1.5.0 - */ - public $on_standardsecond; - - /** - * The part-second in local standard time - * - * @var float - * @access private - * @since Property available since Release 1.5.0 - */ - public $on_standardpartsecond; - - /** - * Whether the object should accept and count leap seconds - * - * @var bool - * @access private - * @since Property available since Release 1.5.0 - */ - public $ob_countleapseconds; - - /** - * Whether the time is valid as a local time (an invalid time - * is one that lies in the 'skipped hour' at the point that - * the clocks go forward) - * - * @var bool - * @access private - * @see Date::isValidTime() - * @since Property available since Release 1.5.0 - */ - public $ob_invalidtime = null; - - /** - * Date_TimeZone object for this date - * - * @var object Date_TimeZone object - * @access private - * @since Property available since Release 1.0 - */ - public $tz; - - /** - * Defines the default weekday abbreviation length - * - * Formerly used by {@link Date::formatLikeStrftime()}, but now - * redundant - the abbreviation for the current locale of the machine - * is used. - * - * @var int - * @access private - * @since Property available since Release 1.4.4 - */ - public $getWeekdayAbbrnameLength = 3; - - - // }}} - // {{{ Constructor - - /** - * Constructor - * - * Creates a new Date Object initialized to the current date/time in the - * system-default timezone by default. A date optionally - * passed in may be in the ISO 8601, TIMESTAMP or UNIXTIME format, - * or another Date object. If no date is passed, the current date/time - * is used. - * - * If a date is passed and an exception is returned by {@link Date::setDate()} - * there is nothing that this function can do, so for this reason, it - * is advisable to pass no parameter and to make a separate call to - * Date::setDate(). A date/time should only be passed if known to be a - * valid ISO 8601 string or a valid Unix timestamp. - * - * @param mixed $date optional ISO 8601 date/time to initialize; - * or, a Unix time stamp - * @param bool $pb_countleapseconds whether to count leap seconds - * (defaults to - * {@link DATE_COUNT_LEAP_SECONDS}) - * - * @return void - * @access public - * @see Date::setDate() - */ - public function Date( - $date = null, - $pb_countleapseconds = DATE_COUNT_LEAP_SECONDS - ) - { - $this->ob_countleapseconds = $pb_countleapseconds; - - if (is_a($date, 'Date')) { - $this->copy($date); - } else { - if (!is_null($date)) { - // 'setDate()' expects a time zone to be already set: - // - $this->_setTZToDefault(); - $this->setDate($date); - } else { - $this->setNow(); - } - } - } - - - // }}} - // {{{ copy() - - /** - * Copy values from another Date object - * - * Makes this Date a copy of another Date object. This is a - * PHP4-compatible implementation of {@link Date::__clone()} in PHP5. - * - * @param object $date Date object to copy - * - * @return void - * @access public - */ - public function copy($date) - { - $this->year = $date->year; - $this->month = $date->month; - $this->day = $date->day; - $this->hour = $date->hour; - $this->minute = $date->minute; - $this->second = $date->second; - $this->partsecond = $date->partsecond; - - $this->on_standardyear = $date->on_standardyear; - $this->on_standardmonth = $date->on_standardmonth; - $this->on_standardday = $date->on_standardday; - $this->on_standardhour = $date->on_standardhour; - $this->on_standardminute = $date->on_standardminute; - $this->on_standardsecond = $date->on_standardsecond; - $this->on_standardpartsecond = $date->on_standardpartsecond; - - $this->ob_countleapseconds = $date->ob_countleapseconds; - $this->ob_invalidtime = $date->ob_invalidtime; - - $this->tz = new Date_TimeZone($date->getTZID()); - - $this->getWeekdayAbbrnameLength = $date->getWeekdayAbbrnameLength; - } - - - // }}} - // {{{ __clone() - - /** - * Copy values from another Date object - * - * Makes this Date a copy of another Date object. For PHP5 - * only. - * - * @return void - * @access public - * @see Date::copy() - */ - public function __clone() - { - // This line of code would be preferable, but will only - // compile in PHP5: - // - // $this->tz = clone $this->tz; - - $this->tz = new Date_TimeZone($this->getTZID()); - } - - - // }}} - // {{{ isNull() - - /** - * Returns whether the object is null (i.e. no date has been set) - * - * If the object is set to an invalid date, then this function will - * still return 'false'. To check whether the date is valid use - * either {@link Date::isValidDate()} (to check the day/month/year - * part of the object only) or {@link Date::isValidTime()} (to check - * the time, in addition to the day/month/year part). - * - * @return bool - * @access public - * @see Date::setDate(), Date::isValidDate(), Date::isValidTime() - * @since Method available since Release 1.5.0 - */ - public function isNull() - { - return is_null($this->year); - } - - - // }}} - // {{{ isValidDate() - - /** - * Returns whether the date (i.e. day/month/year) is valid - * - * It is not possible to set the object to an invalid date using - * {@link Date::setDate()}, but it is possible to do so using the - * following functions: - * - * - {@link Date::setYear()} - * - {@link Date::setMonth()} - * - {@link Date::setDay()} - * - * However you can prevent this possibility (by default) by setting - * {@link DATE_VALIDATE_DATE_BY_DEFAULT} to 'true', in which case - * these three functions will return an error if they specify an - * invalid date, and the object will be unmodified. - * - * Note that this function only checks the day/month/year part of - * the object. Even if this is valid, it is still possible for the - * time to be invalid (see {@link DATE_CORRECTINVALIDTIME_DEFAULT}). - * To check the time as well, use {@link Date::isValidTime()}. - * - * @return bool - * @access public - * @see Date::setDate(), Date::isNull(), Date::isValidTime() - * @since Method available since Release 1.5.0 - */ - public function isValidDate() - { - return - !Date::isNull() && - Date_Calc::isValidDate($this->year, $this->month, $this->day); - } - - - // }}} - // {{{ setDate() - - /** - * Sets the date/time of the object based on the input date and format - * - * Accepts a string in three possible formats, and in this order of - * precedence: - * - * - ISO 8601 date (see {@link http://en.wikipedia.org/wiki/ISO_8601}) - * - Time-Stamp (i.e. 'YYYYMMDDHHMMSS') - * - Unix time-stamp (see {@link http://en.wikipedia.org/wiki/Unix_time}) - * - * Note that if you want to pass a Unix time-stamp then you need to set - * the $format parameter to {@link DATE_FORMAT_UNIXTIME}, or else use the - * method {@link Date::setFromTime()}. - * - * The input string should be a date/time representation in one of the - * following general formats: - * - * - T - * - (non-ISO-standard) - * - (non-ISO-standard) - * - T i.e. without optional representation - * - - * - - * - i.e. without optional