6 $files = glob($folder.
'/*');
7 foreach($files as $file){
14 if(file_exists($filename)){
15 return file_get_contents($filename);
21 return file_put_contents($filename,$data);
24 public static function xcopy($source, $dest, $permissions = 0755){
25 $path = pathinfo($dest);
26 if (!file_exists($path[
'dirname'])) {
27 mkdir($path[
'dirname'], 0777,
true);
29 if (is_link($source)) {
30 return symlink(readlink($source), $dest);
32 if (is_file($source)) {
33 return copy($source, $dest);
36 while (
false !== $entry = $dir->read()) {
37 if ($entry ==
'.' || $entry ==
'..') {
40 self::xcopy(
"$source/$entry",
"$dest/$entry", $permissions);
47 $files = array_diff(scandir($dir), array(
'.',
'..'));
48 foreach ($files as $file) {
49 (is_dir(
"$dir/$file")) ? self::delTree(
"$dir/$file") : unlink(
"$dir/$file");
56 return mkdir($dir,0777,
true);
60 if($path!==
null & $path!==
""){
62 $path=\str_replace(
"\\", DS, $path);
64 $path=\str_replace(
"/", DS, $path);
65 $path=\str_replace(DS.DS, DS, $path);
66 if(!substr($path, -1)=== DS){
70 return \realpath($path);
74 $windows = \strpos(PHP_OS,
'WIN') === 0;
75 $test = $windows ?
'where' :
'command -v';
76 $commands=explode(
"\n",\trim(\shell_exec(
"$test $command")));
77 foreach ($commands as $cmd){
78 if($cmd!=
null && \file_exists($cmd)){