From: Evan Prodromou Date: Mon, 9 Feb 2009 13:44:30 +0000 (-0500) Subject: Add InitializePlugin and CleanupPlugin events X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f4e8cc6d9f88e78876baa54d0ffba77694c56a1b;p=quix0rs-gnu-social.git Add InitializePlugin and CleanupPlugin events We add two events to allow plugins to initialize and cleanup. --- diff --git a/EVENTS.txt b/EVENTS.txt index 68e25fa3b0..4b8260b3ce 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 dac5a8071a..0a79b9731d 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 64c7f2410a..2f85eb7c51 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');