summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-02-09 08:44:30 -0500
committerEvan Prodromou <evan@controlyourself.ca>2009-02-09 08:44:30 -0500
commitf4e8cc6d9f88e78876baa54d0ffba77694c56a1b (patch)
tree1e55ae6a5724be020d1d39f729c4433f369c87e8
parent5d246299b630c55d98cc03eeb650561defbeeff4 (diff)
Add InitializePlugin and CleanupPlugin events
We add two events to allow plugins to initialize and cleanup.
-rw-r--r--EVENTS.txt5
-rw-r--r--index.php5
-rw-r--r--lib/common.php4
3 files changed, 14 insertions, 0 deletions
diff --git a/EVENTS.txt b/EVENTS.txt
index 68e25fa3b..4b8260b3c 100644
--- a/EVENTS.txt
+++ b/EVENTS.txt
@@ -1,3 +1,8 @@
+InitializePlugin: a chance to initialize a plugin in a complete
+ environment
+
+CleanupPlugin: a chance to cleanup a plugin at the end of a program
+
StartPrimaryNav: Showing the primary nav menu
- $action: the current action
diff --git a/index.php b/index.php
index dac5a8071..0a79b9731 100644
--- a/index.php
+++ b/index.php
@@ -85,3 +85,8 @@ if (!file_exists($actionfile)) {
$sac->showPage();
}
}
+
+// XXX: cleanup exit() calls or add an exit handler so
+// this always gets called
+
+Event::handle('CleanupPlugin');
diff --git a/lib/common.php b/lib/common.php
index 64c7f2410..2f85eb7c5 100644
--- a/lib/common.php
+++ b/lib/common.php
@@ -212,3 +212,7 @@ function __autoload($class)
require_once(INSTALLDIR.'/lib/' . strtolower($class) . '.php');
}
}
+
+// Give plugins a chance to initialize in a fully-prepared environment
+
+Event::handle('InitializePlugin');