]> git.mjollnir.org Git - moodle.git/commitdiff
Wrapper file to make moodlelib.php functions accessible as a class
authormoodler <moodler>
Fri, 6 Dec 2002 11:23:42 +0000 (11:23 +0000)
committermoodler <moodler>
Fri, 6 Dec 2002 11:23:42 +0000 (11:23 +0000)
called moodlelib.  Based on idea from Greg Barnett:
http://moodle.com/mod/forum/discuss.php?d=356

lib/class.moodlelib.php [new file with mode: 0644]

diff --git a/lib/class.moodlelib.php b/lib/class.moodlelib.php
new file mode 100644 (file)
index 0000000..f179d47
--- /dev/null
@@ -0,0 +1,30 @@
+<?PHP // %Id%
+
+// This file is not currently used within Moodle - see moodlelib.php
+//
+// It exists to provide a more object-oriented interface to some of 
+// Moodle's main library functions, for use by external programs.
+//
+// This code is based on code from Greg Barnett for Crown College
+
+$moodlelibfile = file("moodlelib.php");
+
+$append = false;
+$moodlelib = "";
+
+foreach ($moodlelibfile as $line) {
+    if (!$append) {
+        if (substr($line, 0, 5) == "<?PHP") {
+            $append = true;
+        }
+    } else {
+        if (substr($line, 0, 2) == "?>") {
+            break;
+        }
+        $moodlelib .= $line;
+    }
+}
+
+eval ("class moodlelib { $moodlelib }");
+
+?>