20function get_folder_files($path, $subdirs=
false, $fullname=
true, $mask=
"", $forcelowercase=TRUE)
24 $path = str_replace(
'/',
'\\', $path);
25 if(substr($path, -1) !=
'\\')
27 if(!$path || !@is_dir($path))
33 if($handle = opendir($path)) {
34 while(($file = readdir($handle)) !==
false) {
35 if(!is_dir($path.$file)) {
37 $file = strtolower($file);
39 $dir[] = $fullname ? $path.$file : $file;
40 }
else if($mask && preg_match($mask, $file)) {
41 $dir[] = $fullname ? $path.$file : $file;
43 }
else if($subdirs && $file[0] !=
".") {
44 $dir = array_merge($dir,
get_folder_files($path.$file, $subdirs, $fullname, $mask));
93function parse_ini($initext, $changecase=TRUE, $convertwords=TRUE)
95 $ini = preg_split(
"/\r\n|\n/", $initext);
96 $secpattern =
"/^\[(.[^\]]*)\]/i";
99 $entrypattern =
"/^([a-z_0-9]*)\s*=\s*\"?([^\"]*)?\"?\$/i";
100 $strpattern =
"/^\"?(.[^\"]*)\"?\$/i";
107 static $words = array(
"yes",
"on",
"true",
"no",
"off",
"false",
"null");
108 static $values = array( 1, 1, 1, 0, 0, 0,
null);
112 for($i = 0; $i < count($ini); $i++) {
114 $line = trim($ini[$i]);
118 if(strstr($line,
'\"'))
119 $line = str_replace(
'\"',
'/%quote%/', $line);
123 if($line ==
"" || preg_match(
"/^;/i", $line))
126 if(preg_match($secpattern, $line, $matches)) {
133 $sec = ucfirst(strtolower($sec));
135 $section[$sec] = array();
137 } elseif(preg_match($entrypattern, $line, $matches)) {
141 $entry = $matches[1];
144 $entry = strtolower($entry);
146 $value = preg_replace($entrypattern,
"\\2", $line);
150 $value = str_replace(
'/%quote%/',
'"', $value);
155 $index = array_search(strtolower($value), $words);
157 $value = $values[$index];
160 $section[$sec][$entry] = $value;
166 $section[$sec][] = preg_replace($strpattern,
"\\1", $line);