26function file_put_contents($filename, $data, $flags=0, $zcontext=
null)
46function get_folder_files($path, $subdirs=
false, $fullname=
true, $mask=
"", $forcelowercase=TRUE)
50 $path = str_replace(
'/',
'\\', $path);
51 if(substr($path, -1) !=
'\\')
53 if(!$path || !@is_dir($path))
59 if($handle = opendir($path)) {
60 while(($file = readdir($handle)) !==
false) {
61 if(!is_dir($path.$file)) {
63 $file = strtolower($file);
65 $dir[] = $fullname ? $path.$file : $file;
66 }
else if($mask && preg_match($mask, $file)) {
67 $dir[] = $fullname ? $path.$file : $file;
69 }
else if($subdirs && $file[0] !=
".") {
70 $dir = array_merge($dir,
get_folder_files($path.$file, $subdirs, $fullname, $mask));
119function parse_ini($initext, $changecase=TRUE, $convertwords=TRUE)
121 $ini = preg_split(
"/\r\n|\n/", $initext);
122 $secpattern =
"/^\[(.[^\]]*)\]/i";
125 $entrypattern =
"/^([a-z_0-9]*)\s*=\s*\"?([^\"]*)?\"?\$/i";
126 $strpattern =
"/^\"?(.[^\"]*)\"?\$/i";
133 static $words = array(
"yes",
"on",
"true",
"no",
"off",
"false",
"null");
134 static $values = array( 1, 1, 1, 0, 0, 0,
null);
138 for($i = 0; $i < count($ini); $i++) {
140 $line = trim($ini[$i]);
144 if(strstr($line,
'\"'))
145 $line = str_replace(
'\"',
'/%quote%/', $line);
149 if($line ==
"" || preg_match(
"/^;/i", $line))
152 if(preg_match($secpattern, $line, $matches)) {
159 $sec = ucfirst(strtolower($sec));
161 $section[$sec] = array();
163 } elseif(preg_match($entrypattern, $line, $matches)) {
167 $entry = $matches[1];
170 $entry = strtolower($entry);
172 $value = preg_replace($entrypattern,
"\\2", $line);
176 $value = str_replace(
'/%quote%/',
'"', $value);
181 $index = array_search(strtolower($value), $words);
183 $value = $values[$index];
186 $section[$sec][$entry] = $value;
192 $section[$sec][] = preg_replace($strpattern,
"\\1", $line);