db2c3cb0c52ae3155d7936e1408512f9773b5630
[CBFWR.git] / libcbfwr / lib.php
1 <?php
2 /*
3  * 
4  * The Main lib.php file.
5  * 
6  */
7
8 //require_once();
9
10 // get the lib root, and set include path from it
11 $LIB_ROOT_FS = realpath(dirname(__FILE__));
12 global $LIB_ROOT_FS;
13
14 /*
15  * I shouldnt ever need to do this bit, but its here, just in case
16 $adpath = realpath($LIB_ROOT_FS."/../");
17 error_log("added libglcas path as $adpath");
18 set_include_path(get_include_path().PATH_SEPARATOR.$adpath);
19
20 */
21 require_once("libcbfwr/config.php");
22
23 function glcas_pluginLoader($path="")
24 {
25         global $LIB_ROOT_FS;
26         if($path ==  "") {
27                 // try and find it
28                 $plpath = realpath($LIB_ROOT_FS."/../plugins/");
29                 if(file_exists($plpath."/plugin.php")) {
30                         // here it is, load away
31                         error_log("attempting to load plugins from $plpath");
32                         $dh = opendir("$plpath");
33                         if($dh) {
34                                 while(($file = readdir($dh))!==false) {
35                                         $mt = preg_match("/.*.php$/", $file);
36                                         if($mt > 0) {
37                                                 error_log("loading plugin $file");
38                                                 require_once("$plpath/$file");
39                                                 //echo "required $basedir/$file\n";
40                                         }
41                                 }
42                         }                       
43                 }
44         }
45 }
46
47
48 ?>