]> git.mxchange.org Git - friendica-addons.git/blob - dav/SabreDAV/lib/Sabre/DAV/Property/GetLastModified.php
privacy_image_cache: checking if the cached file really is an image
[friendica-addons.git] / dav / SabreDAV / lib / Sabre / DAV / Property / GetLastModified.php
1 <?php
2
3 /**
4  * This property represents the {DAV:}getlastmodified property.
5  *
6  * Although this is normally a simple property, windows requires us to add
7  * some new attributes.
8  *
9  * This class uses unix timestamps internally, and converts them to RFC 1123 times for
10  * serialization
11  *
12  * @package Sabre
13  * @subpackage DAV
14  * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
15  * @author Evert Pot (http://www.rooftopsolutions.nl/)
16  * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
17  */
18 class Sabre_DAV_Property_GetLastModified extends Sabre_DAV_Property {
19
20     /**
21      * time
22      *
23      * @var int
24      */
25     public $time;
26
27     /**
28      * __construct
29      *
30      * @param int|DateTime $time
31      */
32     public function __construct($time) {
33
34         if ($time instanceof DateTime) {
35             $this->time = $time;
36         } elseif (is_int($time) || ctype_digit($time)) {
37             $this->time = new DateTime('@' . $time);
38         } else {
39             $this->time = new DateTime($time);
40         }
41
42         // Setting timezone to UTC
43         $this->time->setTimezone(new DateTimeZone('UTC'));
44
45     }
46
47     /**
48      * serialize
49      *
50      * @param Sabre_DAV_Server $server
51      * @param DOMElement       $prop
52      * @return void
53      */
54     public function serialize(Sabre_DAV_Server $server, DOMElement $prop) {
55
56         $doc = $prop->ownerDocument;
57         $prop->setAttribute('xmlns:b','urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/');
58         $prop->setAttribute('b:dt','dateTime.rfc1123');
59         $prop->nodeValue = Sabre_HTTP_Util::toHTTPDate($this->time);
60
61     }
62
63     /**
64      * getTime
65      *
66      * @return DateTime
67      */
68     public function getTime() {
69
70         return $this->time;
71
72     }
73
74 }
75