scesimple-code-editor

Gesponsorde koppelingen

PHP script bestanden

  1. scesimple-code-editor

« Lees de omschrijving en reacties

De class(rest moet je dowloaden)

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
class sce {
        public function iniGet($get) {
            if($get == "start_dir") return $_SERVER['DOCUMENT_ROOT'];
        }

        public function getDirs($startdir) {
            $dir = opendir($_SERVER['DOCUMENT_ROOT'].'/'.$startdir);
            $dirs =array();
            while(($dir2 = readdir($dir)) !== false) {
                if(is_dir($_SERVER['DOCUMENT_ROOT'].'/'.$startdir.'/'.$dir2) && $dir2 != ".") $dirs[] = $dir2;
            }

            return $dirs;
        }

        public function getFiles($startdir) {
            $dir = opendir($_SERVER['DOCUMENT_ROOT'].'/'.$startdir);
            $files =array();
            while(($file = readdir($dir)) !== false) {
                if(!is_dir($_SERVER['DOCUMENT_ROOT'].'/'.$startdir.'/'.$file)) $files[] = $file;
            }

            return $files;
        }

        public function delDir($dir){
            $current_dir = opendir($dir);
            while($entryname = readdir($current_dir)){
                if(is_dir("$dir/$entryname") and ($entryname != "." and $entryname!="..")){
                    $this->delDir("${dir}/${entryname}");
                }
elseif($entryname != "." and $entryname!=".."){
                    unlink("${dir}/${entryname}");
                }    
            }

            closedir($current_dir);
            rmdir(${dir});
        }

        public function extensions() {
            return array("php"=> array("Hypertext Preprocessor",true),
            "html"=>array("HyperText Markup Language", true),
            "htm"=>array("HyperText Markup Language", true),
            "js"=>array("Javascript", true),
            "tpl"=>array("Template", true),
            "gif"=>array("Image", false));
        }

        public function get_extensions($file) {
            $extensions = $this->extensions();
            
            $file = preg_replace("#(.*)\.(.*)#", "\\2", $file);
            $file = strtolower($file);
            foreach($extensions as $ex=>$text) {
                $file = str_replace($ex, $text[0], $file);
            }
    
            return $file;
        }

        public function create_dir($dir,  $chmod = "775") {
        if(!file_exists($dir)) {
            mkdir ($dir, '0'.$chmod);
            return true;
        }
else{
            return false;
        }
    }

        public function file_size($name) {
        
        if(!is_dir($name)) {
            return filesize($name);
        }
else{
            return '-';
        }
    }
}

?>

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.