Edit File by line
/home/barbar84/www/wp-inclu.../IXR
File: class-IXR-date.php
<?php
[0] Fix | Delete
[1] Fix | Delete
/**
[2] Fix | Delete
* IXR_Date
[3] Fix | Delete
*
[4] Fix | Delete
* @package IXR
[5] Fix | Delete
* @since 1.5.0
[6] Fix | Delete
*/
[7] Fix | Delete
class IXR_Date {
[8] Fix | Delete
var $year;
[9] Fix | Delete
var $month;
[10] Fix | Delete
var $day;
[11] Fix | Delete
var $hour;
[12] Fix | Delete
var $minute;
[13] Fix | Delete
var $second;
[14] Fix | Delete
var $timezone;
[15] Fix | Delete
[16] Fix | Delete
/**
[17] Fix | Delete
* PHP5 constructor.
[18] Fix | Delete
*/
[19] Fix | Delete
function __construct( $time )
[20] Fix | Delete
{
[21] Fix | Delete
// $time can be a PHP timestamp or an ISO one
[22] Fix | Delete
if (is_numeric($time)) {
[23] Fix | Delete
$this->parseTimestamp($time);
[24] Fix | Delete
} else {
[25] Fix | Delete
$this->parseIso($time);
[26] Fix | Delete
}
[27] Fix | Delete
}
[28] Fix | Delete
[29] Fix | Delete
/**
[30] Fix | Delete
* PHP4 constructor.
[31] Fix | Delete
*/
[32] Fix | Delete
public function IXR_Date( $time ) {
[33] Fix | Delete
self::__construct( $time );
[34] Fix | Delete
}
[35] Fix | Delete
[36] Fix | Delete
function parseTimestamp($timestamp)
[37] Fix | Delete
{
[38] Fix | Delete
$this->year = gmdate('Y', $timestamp);
[39] Fix | Delete
$this->month = gmdate('m', $timestamp);
[40] Fix | Delete
$this->day = gmdate('d', $timestamp);
[41] Fix | Delete
$this->hour = gmdate('H', $timestamp);
[42] Fix | Delete
$this->minute = gmdate('i', $timestamp);
[43] Fix | Delete
$this->second = gmdate('s', $timestamp);
[44] Fix | Delete
$this->timezone = '';
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
function parseIso($iso)
[48] Fix | Delete
{
[49] Fix | Delete
$this->year = substr($iso, 0, 4);
[50] Fix | Delete
$this->month = substr($iso, 4, 2);
[51] Fix | Delete
$this->day = substr($iso, 6, 2);
[52] Fix | Delete
$this->hour = substr($iso, 9, 2);
[53] Fix | Delete
$this->minute = substr($iso, 12, 2);
[54] Fix | Delete
$this->second = substr($iso, 15, 2);
[55] Fix | Delete
$this->timezone = substr($iso, 17);
[56] Fix | Delete
}
[57] Fix | Delete
[58] Fix | Delete
function getIso()
[59] Fix | Delete
{
[60] Fix | Delete
return $this->year.$this->month.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second.$this->timezone;
[61] Fix | Delete
}
[62] Fix | Delete
[63] Fix | Delete
function getXml()
[64] Fix | Delete
{
[65] Fix | Delete
return '<dateTime.iso8601>'.$this->getIso().'</dateTime.iso8601>';
[66] Fix | Delete
}
[67] Fix | Delete
[68] Fix | Delete
function getTimestamp()
[69] Fix | Delete
{
[70] Fix | Delete
return mktime($this->hour, $this->minute, $this->second, $this->month, $this->day, $this->year);
[71] Fix | Delete
}
[72] Fix | Delete
}
[73] Fix | Delete
[74] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function