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