function apms_form_list() { $arr = array(); $path = G5_SKIN_PATH . '/apms/form'; if (is_dir($path)) { $handle = opendir($path); while ($file = readdir($handle)) { if ($file == "." || $file == "..") { continue; } $ext = apms_get_ext($file); if ($ext == 'php') { $arr[] = $file; } } closedir($handle); sort($arr); } return $arr; }
function thema_switcher($type, $path, $val, $ext = '') { if (!$path) { return; } $arr = array(); $set = array(); if ($type == 'thema') { $path = THEMA_PATH . '/' . $path; } if (!is_dir($path)) { return; } $handle = opendir($path); while ($file = readdir($handle)) { if ($file == "." || $file == "..") { continue; } if ($ext) { if (!preg_match("/\\.(" . $ext . ")\$/i", $file)) { continue; } } else { if (!is_dir($path . '/' . $file)) { continue; } } $arr[] = $file; } closedir($handle); sort($arr); $i = 0; foreach ($arr as $key => $value) { $set[$i]['name'] = $arr[$key]; $set[$i]['value'] = $arr[$key]; if ($ext) { $set[$i]['value'] = str_replace("." . apms_get_ext($set[$i]['value']), "", $set[$i]['value']); } $set[$i]['selected'] = $set[$i]['value'] == $val ? true : false; $i++; } return $set; }
function apms_skin_file_list($file_path, $ext = 'php') { $arr = array(); $file_path = $file_path . '/'; if (!is_dir($file_path)) { return; } $handle = opendir($file_path); while ($file = readdir($handle)) { if ($file == "." || $file == "..") { continue; } if ($ext) { $tmp = apms_get_ext($file); if ($tmp == $ext) { $name = explode("." . $ext, $file); $arr[] = $name[0]; } } else { $arr[] = $file; } } closedir($handle); sort($arr); return $arr; }