library/SimplePie/Cache/File.php Quellcode

File.php
gehe zur Dokumentation dieser Datei
1 <?php
52 {
59  protected $location;
60 
66  protected $filename;
67 
73  protected $extension;
74 
80  protected $name;
81 
89  public function __construct($location, $name, $type)
90  {
91  $this->location = $location;
92  $this->filename = $name;
93  $this->extension = $type;
94  $this->name = "$this->location/$this->filename.$this->extension";
95  }
96 
103  public function save($data)
104  {
105  if (file_exists($this->name) && is_writeable($this->name) || file_exists($this->location) && is_writeable($this->location))
106  {
107  if ($data instanceof SimplePie)
108  {
109  $data = $data->data;
110  }
111 
112  $data = serialize($data);
113  return (bool) file_put_contents($this->name, $data);
114  }
115  return false;
116  }
117 
123  public function load()
124  {
125  if (file_exists($this->name) && is_readable($this->name))
126  {
127  return unserialize(file_get_contents($this->name));
128  }
129  return false;
130  }
131 
137  public function mtime()
138  {
139  if (file_exists($this->name))
140  {
141  return filemtime($this->name);
142  }
143  return false;
144  }
145 
151  public function touch()
152  {
153  if (file_exists($this->name))
154  {
155  return touch($this->name);
156  }
157  return false;
158  }
159 
165  public function unlink()
166  {
167  if (file_exists($this->name))
168  {
169  return unlink($this->name);
170  }
171  return false;
172  }
173 }




Korrekturen, Hinweise und Ergänzungen

Bitte scheuen Sie sich nicht und melden Sie, was auf dieser Seite sachlich falsch oder irreführend ist, was ergänzt werden sollte, was fehlt usw. Dazu bitte oben aus dem Menü Seite den Eintrag Support Forum wählen. Es ist eine kostenlose Anmeldung erforderlich, um Anmerkungen zu posten. Unpassende Postings, Spam usw. werden kommentarlos entfernt.