1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-05 13:47:33 +02:00

DateTime53 renamed to DibiDateTime

This commit is contained in:
David Grudl
2010-10-06 16:02:20 +02:00
parent 90592929ec
commit 8d6639fa3c
5 changed files with 25 additions and 30 deletions

View File

@@ -41,8 +41,6 @@ if (!defined('NETTE')) {
class IOException extends RuntimeException {} class IOException extends RuntimeException {}
class FileNotFoundException extends IOException {} class FileNotFoundException extends IOException {}
/**#@-*/ /**#@-*/
require_once dirname(__FILE__) . '/Nette/DateTime53.php';
} }
@@ -65,21 +63,9 @@ class PcreException extends Exception {
/**
* @deprecated
*/
class DibiVariable extends DateTime53
{
function __construct($val)
{
parent::__construct($val);
}
}
// dibi libraries // dibi libraries
require_once dirname(__FILE__) . '/libs/interfaces.php'; require_once dirname(__FILE__) . '/libs/interfaces.php';
require_once dirname(__FILE__) . '/libs/DibiDateTime.php';
require_once dirname(__FILE__) . '/libs/DibiObject.php'; require_once dirname(__FILE__) . '/libs/DibiObject.php';
require_once dirname(__FILE__) . '/libs/DibiLazyStorage.php'; require_once dirname(__FILE__) . '/libs/DibiLazyStorage.php';
require_once dirname(__FILE__) . '/libs/DibiException.php'; require_once dirname(__FILE__) . '/libs/DibiException.php';
@@ -95,6 +81,19 @@ require_once dirname(__FILE__) . '/libs/DibiProfiler.php';
/**
* @deprecated
*/
class DibiVariable extends DibiDateTime
{
function __construct($val)
{
parent::__construct($val);
}
}
/** /**
@@ -593,7 +592,7 @@ class dibi
*/ */
public static function datetime($time = NULL) public static function datetime($time = NULL)
{ {
return new DateTime53(is_numeric($time) ? date('Y-m-d H:i:s', $time) : $time); return new DibiDateTime(is_numeric($time) ? date('Y-m-d H:i:s', $time) : $time);
} }
@@ -603,7 +602,7 @@ class dibi
*/ */
public static function date($date = NULL) public static function date($date = NULL)
{ {
return new DateTime53(is_numeric($date) ? date('Y-m-d', $date) : $date); return new DibiDateTime(is_numeric($date) ? date('Y-m-d', $date) : $date);
} }

View File

@@ -1,25 +1,23 @@
<?php <?php
/** /**
* This file is part of the Nette Framework. * This file is part of the "dibi" - smart database abstraction layer.
* *
* Copyright (c) 2004, 2010 David Grudl (http://davidgrudl.com) * Copyright (c) 2005, 2010 David Grudl (http://davidgrudl.com)
* *
* This source file is subject to the "Nette license", and/or * This source file is subject to the "dibi license", and/or
* GPL license. For more information please see http://nette.org * GPL license. For more information please see http://dibiphp.com
* @package dibi
*/ */
// no namespace
/** /**
* DateTime with serialization and timestamp support for PHP 5.2. * DateTime with serialization and timestamp support for PHP 5.2.
* *
* @author David Grudl * @author David Grudl
* @package Nette
*/ */
class DateTime53 extends DateTime class DibiDateTime extends DateTime
{ {
public function __sleep() public function __sleep()

View File

@@ -592,7 +592,7 @@ class DibiResult extends DibiObject implements IDataSource
return NULL; return NULL;
} elseif ($this->dateFormat === '') { // return DateTime object (default) } elseif ($this->dateFormat === '') { // return DateTime object (default)
return new DateTime53(is_numeric($value) ? date('Y-m-d H:i:s', $value) : $value); return new DibiDateTime(is_numeric($value) ? date('Y-m-d H:i:s', $value) : $value);
} elseif ($this->dateFormat === 'U') { // return timestamp } elseif ($this->dateFormat === 'U') { // return timestamp
return is_numeric($value) ? (int) $value : strtotime($value); return is_numeric($value) ? (int) $value : strtotime($value);
@@ -601,7 +601,7 @@ class DibiResult extends DibiObject implements IDataSource
return date($this->dateFormat, $value); return date($this->dateFormat, $value);
} else { } else {
$value = new DateTime53($value); $value = new DibiDateTime($value);
return $value->format($this->dateFormat); return $value->format($this->dateFormat);
} }

View File

@@ -46,7 +46,7 @@ class DibiRow implements ArrayAccess, IteratorAggregate, Countable
if ((int) $time === 0) { // '', NULL, FALSE, '0000-00-00', ... if ((int) $time === 0) { // '', NULL, FALSE, '0000-00-00', ...
return NULL; return NULL;
} }
$dt = new DateTime53(is_numeric($time) ? date('Y-m-d H:i:s', $time) : $time); $dt = new DibiDateTime(is_numeric($time) ? date('Y-m-d H:i:s', $time) : $time);
return $format === NULL ? $dt : $dt->format($format); return $format === NULL ? $dt : $dt->format($format);
} }

View File

@@ -1,2 +0,0 @@
Disallow: /drivers
Disallow: /Nette