]> git.mxchange.org Git - friendica.git/blob - src/Model/Storage/SystemResource.php
203e9a2892125a1ecbf21009fec326982283d00b
[friendica.git] / src / Model / Storage / SystemResource.php
1 <?php
2 /**
3  * @file src/Model/Storage/SystemStorage.php
4  */
5
6 namespace Friendica\Model\Storage;
7
8 /**
9  * @brief System resource storage class
10  *
11  * This class is used to load system resources, like images.
12  * Is not itended to be selectable by admins as default storage class.
13  */
14 class SystemResource
15 {
16         // Valid folders to look for resources
17         const VALID_FOLDERS = [ "images" ];
18
19         /**
20          * @brief get data
21          *
22          * @param string  $resourceid
23          *
24          * @return string
25          */
26         static function get($filename)
27         {
28                 $folder = dirname($filename);
29                 if (!in_array($folder, self::VALID_FOLDERS)) return "";
30                 if (!file_exists($filename)) return "";
31                 return file_get_contents($filename);
32         }
33
34         static function put($filename, $data)
35         {
36                 throw new \BadMethodCallException();
37         }
38 }
39