]> git.mxchange.org Git - friendica-addons.git/blob - dav/SabreDAV/lib/Sabre/DAV/FS/Node.php
Initial Release of the calendar plugin
[friendica-addons.git] / dav / SabreDAV / lib / Sabre / DAV / FS / Node.php
1 <?php
2
3 /**
4  * Base node-class
5  *
6  * The node class implements the method used by both the File and the Directory classes
7  *
8  * @package Sabre
9  * @subpackage DAV
10  * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
11  * @author Evert Pot (http://www.rooftopsolutions.nl/)
12  * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
13  */
14 abstract class Sabre_DAV_FS_Node implements Sabre_DAV_INode {
15
16     /**
17      * The path to the current node
18      *
19      * @var string
20      */
21     protected $path;
22
23     /**
24      * Sets up the node, expects a full path name
25      *
26      * @param string $path
27      */
28     public function __construct($path) {
29
30         $this->path = $path;
31
32     }
33
34
35
36     /**
37      * Returns the name of the node
38      *
39      * @return string
40      */
41     public function getName() {
42
43         list(, $name)  = Sabre_DAV_URLUtil::splitPath($this->path);
44         return $name;
45
46     }
47
48     /**
49      * Renames the node
50      *
51      * @param string $name The new name
52      * @return void
53      */
54     public function setName($name) {
55
56         list($parentPath, ) = Sabre_DAV_URLUtil::splitPath($this->path);
57         list(, $newName) = Sabre_DAV_URLUtil::splitPath($name);
58
59         $newPath = $parentPath . '/' . $newName;
60         rename($this->path,$newPath);
61
62         $this->path = $newPath;
63
64     }
65
66
67
68     /**
69      * Returns the last modification time, as a unix timestamp
70      *
71      * @return int
72      */
73     public function getLastModified() {
74
75         return filemtime($this->path);
76
77     }
78
79 }
80