]> git.mxchange.org Git - friendica.git/blob - src/Model/Storage/SystemResource.php
Forums now are working with AP as well
[friendica.git] / src / Model / Storage / SystemResource.php
1 <?php
2 /**
3  * @file src/Model/Storage/SystemStorage.php
4  * @brief Storage backend system
5  */
6
7 namespace Friendica\Model\Storage;
8
9 use \BadMethodCallException;
10
11 /**
12  * @brief System resource storage class
13  *
14  * This class is used to load system resources, like images.
15  * Is not intended to be selectable by admins as default storage class.
16  */
17 class SystemResource implements IStorage
18 {
19         // Valid folders to look for resources
20         const VALID_FOLDERS = ["images"];
21
22         public static function get($filename)
23         {
24                 $folder = dirname($filename);
25                 if (!in_array($folder, self::VALID_FOLDERS)) {
26                         return "";
27                 }
28                 if (!file_exists($filename)) {
29                         return "";
30                 }
31                 return file_get_contents($filename);
32         }
33
34
35         public static function put($data, $filename = "")
36         {
37                 throw new BadMethodCallException();
38         }
39
40         public static function delete($filename)
41         {
42                 throw new BadMethodCallException();
43         }
44
45         public static function getOptions()
46         {
47                 return [];
48         }
49
50         public static function saveOptions($data)
51         {
52                 return [];
53         }
54 }
55