Skip to content
Browse files

Wrapper file to make moodlelib.php functions accessible as a class

called moodlelib.  Based on idea from Greg Barnett:
http://moodle.com/mod/forum/discuss.php?d=356
  • Loading branch information...
1 parent a7ce613 commit 2ccb36740b80583d8b50d2f226ac5b2de069204f moodler committed Dec 6, 2002
Showing with 30 additions and 0 deletions.
  1. +30 −0 lib/class.moodlelib.php
View
30 lib/class.moodlelib.php
@@ -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 }");
+
+?>

0 comments on commit 2ccb367

Please sign in to comment.
Something went wrong with that request. Please try again.