aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/plugins.php
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-02-15 12:57:00 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-02-15 12:57:00 +0000
commit23a34583a812bbbe5df0bcdc4a40ba32bc4ce409 (patch)
treee018e3e1bf3ef1261cf683e965966b01627ec333 /engine/lib/plugins.php
parent395fe163c4658dda3b101508b070e30cc6fb6dc1 (diff)
downloadelgg-23a34583a812bbbe5df0bcdc4a40ba32bc4ce409.tar.gz
elgg-23a34583a812bbbe5df0bcdc4a40ba32bc4ce409.tar.bz2
Simple plugin mechanism
git-svn-id: https://code.elgg.org/elgg/trunk@39 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/plugins.php')
-rw-r--r--engine/lib/plugins.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php
new file mode 100644
index 000000000..81f5757e9
--- /dev/null
+++ b/engine/lib/plugins.php
@@ -0,0 +1,46 @@
+<?php
+
+ /**
+ * Elgg plugins library
+ * Contains functions for managing plugins
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ */
+
+
+ /**
+ * For now, loads plugins directly
+ *
+ * @todo Add proper plugin handler that launches plugins in an admin-defined order and activates them on admin request
+ */
+ function load_plugins() {
+
+ global $CONFIG;
+ if (!empty($CONFIG->pluginspath)) {
+
+ if ($handle = opendir($CONFIG->pluginspath)) {
+ while ($mod = readdir($handle)) {
+ if (!in_array($mod,array('.','..','.svn','CVS')) && is_dir($mod)) {
+ if (!@include($ONFIG->pluginspath . $mod . "/start.php"))
+ throw new PluginException("{$mod} is a misconfigured plugin.");
+ }
+ }
+ }
+
+ }
+
+ }
+
+ /**
+ * @class PluginException
+ * A plugin Exception, thrown when an Exception occurs relating to the plugin mechanism. Subclass for specific plugin Exceptions.
+ */
+
+ class PluginException extends Exception {}
+
+?> \ No newline at end of file