1 | <?php |
||
6 | class UserLogUtility extends XoopsObject |
||
|
|||
7 | { |
||
8 | /** |
||
9 | * Function responsible for checking if a directory exists, we can also write in and create an index.html file |
||
10 | * |
||
11 | * @param string $folder The full path of the directory to check |
||
12 | * |
||
13 | * @return void |
||
14 | */ |
||
15 | public static function createFolder($folder) |
||
16 | { |
||
17 | // try { |
||
18 | // if (!mkdir($folder) && !is_dir($folder)) { |
||
19 | // throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); |
||
20 | // } else { |
||
21 | // file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>'); |
||
22 | // } |
||
23 | // } |
||
24 | // catch (Exception $e) { |
||
25 | // echo 'Caught exception: ', $e->getMessage(), "\n", '<br>'; |
||
26 | // } |
||
27 | try { |
||
28 | if (!file_exists($folder)) { |
||
29 | if (!mkdir($folder) && !is_dir($folder)) { |
||
30 | throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); |
||
31 | } |
||
32 | |||
33 | file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>'); |
||
34 | } |
||
35 | } catch (Exception $e) { |
||
36 | echo 'Caught exception: ', $e->getMessage(), "\n", '<br>'; |
||
37 | } |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * @param $file |
||
42 | * @param $folder |
||
43 | * @return bool |
||
44 | */ |
||
45 | public static function copyFile($file, $folder) |
||
59 | |||
60 | /** |
||
61 | * @param $src |
||
62 | * @param $dst |
||
63 | */ |
||
64 | public static function recurseCopy($src, $dst) |
||
79 | |||
80 | /** |
||
81 | * |
||
82 | * Verifies XOOPS version meets minimum requirements for this module |
||
83 | * @static |
||
84 | * @param XoopsModule $module |
||
85 | * |
||
86 | * @param null|string $requiredVer |
||
87 | * @return bool true if meets requirements, false if not |
||
88 | */ |
||
89 | public static function checkVerXoops(XoopsModule $module = null, $requiredVer = null) |
||
130 | |||
131 | /** |
||
132 | * |
||
133 | * Verifies PHP version meets minimum requirements for this module |
||
134 | * @static |
||
135 | * @param XoopsModule $module |
||
136 | * |
||
137 | * @return bool true if meets requirements, false if not |
||
138 | */ |
||
139 | public static function checkVerPhp(XoopsModule $module) |
||
155 | } |
||
156 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.