more framework
authorpaulr <me@pjr.cc>
Mon, 19 Sep 2011 05:45:41 +0000 (15:45 +1000)
committerpaulr <me@pjr.cc>
Mon, 19 Sep 2011 05:45:41 +0000 (15:45 +1000)
bin/fwc.php
lib/lib.php [deleted file]
libcbfwr/lib.php [new file with mode: 0644]
plugins/plugin.php [new file with mode: 0644]
www/index.php

index e69de29..25d56cc 100644 (file)
@@ -0,0 +1,16 @@
+<?php
+$CMD_ROOT_FS = realpath(dirname(__FILE__));
+
+global $CMD_ROOT_FS;
+
+// add libglcas as if it were a path in ../libglcas
+if(file_exists("../libcbfwr")) {
+       $path = realpath($CMD_ROOT_FS."/../");
+       error_log("added cbfwr path as $path");
+       set_include_path(get_include_path().PATH_SEPARATOR.$path);
+}
+
+// include the based library
+require_once("libcbfwr/lib.php");
+
+?>
\ No newline at end of file
diff --git a/lib/lib.php b/lib/lib.php
deleted file mode 100644 (file)
index 67c94a5..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-<?php
-?>
\ No newline at end of file
diff --git a/libcbfwr/lib.php b/libcbfwr/lib.php
new file mode 100644 (file)
index 0000000..db2c3cb
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+/*
+ * 
+ * The Main lib.php file.
+ * 
+ */
+
+//require_once();
+
+// get the lib root, and set include path from it
+$LIB_ROOT_FS = realpath(dirname(__FILE__));
+global $LIB_ROOT_FS;
+
+/*
+ * I shouldnt ever need to do this bit, but its here, just in case
+$adpath = realpath($LIB_ROOT_FS."/../");
+error_log("added libglcas path as $adpath");
+set_include_path(get_include_path().PATH_SEPARATOR.$adpath);
+
+*/
+require_once("libcbfwr/config.php");
+
+function glcas_pluginLoader($path="")
+{
+       global $LIB_ROOT_FS;
+       if($path ==  "") {
+               // try and find it
+               $plpath = realpath($LIB_ROOT_FS."/../plugins/");
+               if(file_exists($plpath."/plugin.php")) {
+                       // here it is, load away
+                       error_log("attempting to load plugins from $plpath");
+                       $dh = opendir("$plpath");
+                       if($dh) {
+                               while(($file = readdir($dh))!==false) {
+                                       $mt = preg_match("/.*.php$/", $file);
+                                       if($mt > 0) {
+                                               error_log("loading plugin $file");
+                                               require_once("$plpath/$file");
+                                               //echo "required $basedir/$file\n";
+                                       }
+                               }
+                       }                       
+               }
+       }
+}
+
+
+?>
\ No newline at end of file
diff --git a/plugins/plugin.php b/plugins/plugin.php
new file mode 100644 (file)
index 0000000..497208a
--- /dev/null
@@ -0,0 +1,4 @@
+<?php
+// im just something to make sure the directory gets created
+error_log("base plugin loaded");
+?>
\ No newline at end of file
index 15c5adc..dd6163c 100644 (file)
@@ -1,3 +1,17 @@
 <?php
+$WEB_ROOT_FS = realpath(dirname(__FILE__));
+$BASE_URL = dirname($_SERVER["PHP_SELF"]);
+
+global $WEB_ROOT_FS, $URL_HANDLERS, $BASE_URL;
+
+// add libglcas as if it were a path in ../libglcas
+if(file_exists("../libcbfwr")) {
+       $path = realpath($WEB_ROOT_FS."/../");
+       error_log("added cbfwr path as $path");
+       set_include_path(get_include_path().PATH_SEPARATOR.$path);
+}
+
+// include the based library
+require_once("libcbfwr/lib.php");
 
 ?>
\ No newline at end of file