Server IP : 195.201.23.43 / Your IP : 3.14.8.164 Web Server : Apache System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64 User : kdecoratie ( 1041) PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/kdecoratie/public_html/libraries/fof30/Date/ |
Upload File : |
<?php /** * @package FOF * @copyright Copyright (c)2010-2019 Nicholas K. Dionysopoulos / Akeeba Ltd * @license GNU GPL version 2 or later */ namespace FOF30\Date; use DateInterval; use DateTime; use JDatabaseDriver; defined('_JEXEC') or die; /** * This decorator will get any DateTime descendant and turn it into a FOF30\Date\Date compatible class. If the methods * specific to Date/JDate are available they will be used. Otherwise a new Date object will be spun from the information * in the decorated DateTime object and the results of a call to its method will be returned. */ class DateDecorator extends Date { /** * The decorated object * * @var DateTime */ protected $decorated = null; public function __construct($date = 'now', $tz = null) { if (is_object($date) && ($date instanceof DateTime)) { $this->decorated = $date; } else { $this->decorated = new Date($date, $tz); } $timestamp = $this->decorated->toISO8601(true); parent::__construct($timestamp); $this->setTimezone($this->decorated->getTimezone()); return; } /** * Magic method to access properties of the date given by class to the format method. * * @param string $name The name of the property. * * @return mixed A value if the property name is valid, null otherwise. */ public function __get($name) { return $this->decorated->$name; } public function __call($name, $arguments) { if (method_exists($this->decorated, $name)) { return call_user_func_array(array($this->decorated, $name), $arguments); } throw new \InvalidArgumentException("JDate object does not have a $name method"); } public function sub($interval) { // Note to self: ignore phpStorm; we must NOT use a typehint for $interval return $this->decorated->sub($interval); } public function add($interval) { // Note to self: ignore phpStorm; we must NOT use a typehint for $interval return $this->decorated->add($interval); } public function modify($modify) { return $this->decorated->modify($modify); } public function __toString() { return (string) $this->decorated; } public static function getInstance($date = 'now', $tz = null) { $coreObject = new Date($date, $tz); return new DateDecorator($coreObject); } public function dayToString($day, $abbr = false) { return $this->decorated->dayToString($day, $abbr); } public function calendar($format, $local = false, $translate = true) { return $this->decorated->calendar($format, $local, $translate); } public function format($format, $local = false, $translate = true) { return $this->decorated->format($format, $local, $translate); } public function getOffsetFromGmt($hours = false) { return $this->decorated->getOffsetFromGMT($hours); } public function monthToString($month, $abbr = false) { return $this->monthToString($month, $abbr); } public function setTimezone($tz) { return $this->decorated->setTimezone($tz); } public function toISO8601($local = false) { return $this->decorated->toISO8601($local); } public function toSql($local = false, JDatabaseDriver $db = null) { return $this->decorated->toSql($local, $db); } public function toRFC822($local = false) { return $this->decorated->toRFC822($local); } public function toUnix() { return $this->decorated->toUnix(); } }Private