a09bbd74128a17dfde2ca409c355c865691092cd
1 #!/usr/bin/php5
2 <?php
4 /* Function to include all class_ files starting at a given directory base */
5 function get_classes($folder= ".")
6 {
7 static $result= array();
9 $currdir=getcwd();
10 if ($folder){
11 chdir("$folder");
12 }
14 $dh = opendir(".");
15 while(false !== ($file = readdir($dh))){
17 if (preg_match("/.*\.svn.*/", $file) ||
18 preg_match("/.*smarty.*/i",$file) ||
19 preg_match("/.*\.tpl.*/",$file) ||
20 ($file==".") ||($file =="..")){
21 continue;
22 }
24 /* Recurse through all "common" directories */
25 if (is_dir($file)){
26 get_classes($file);
27 continue;
28 }
30 /* Include existing class_ files */
31 if (preg_match("/^class_.*\.inc$/", $file)) {
33 $result[]= "$currdir/$folder/$file";
34 }
35 }
37 closedir($dh);
38 chdir($currdir);
40 return ($result);
41 }
43 print_r(get_declared_classes());
44 exit (0);
45 $class_mapping= get_classes();
46 foreach ($class_mapping as $key => $value){
47 echo "$key located in $value\n";
48 }
50 ?>