aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/plugins.php
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-16 22:37:00 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-16 22:37:00 +0000
commit8203c8bd6c099146591ad3391fee3c40578e2e6d (patch)
tree12a21bca24ba039e5aff2cfaa37b905f43a18937 /engine/lib/plugins.php
parent0eb11397722ff6dcf9edfa22933993160f12ca1c (diff)
downloadelgg-8203c8bd6c099146591ad3391fee3c40578e2e6d.tar.gz
elgg-8203c8bd6c099146591ad3391fee3c40578e2e6d.tar.bz2
Registers contexts for each menu item. Refs #32
git-svn-id: https://code.elgg.org/elgg/trunk@938 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/plugins.php')
-rw-r--r--engine/lib/plugins.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php
index 8a008f278..036a2d5b9 100644
--- a/engine/lib/plugins.php
+++ b/engine/lib/plugins.php
@@ -45,6 +45,27 @@
}
/**
+ * Get the name of the most recent plugin to be called in the call stack.
+ *
+ * i.e., if the last plugin was in /mod/foobar/, get_plugin_name would return foo_bar.
+ *
+ * @return string|false Plugin name, or false if no plugin name was called
+ */
+ function get_plugin_name() {
+ if ($backtrace = debug_backtrace()) {
+ foreach($backtrace as $step) {
+ $file = $step['file'];
+ $file = str_replace("\\","/",$file);
+ $file = str_replace("//","/",$file);
+ if (preg_match("/mod\/([a-zA-Z0-9\-\_]*)\/start\.php$/",$file,$matches)) {
+ return $matches[1];
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
* PluginException
*
* A plugin Exception, thrown when an Exception occurs relating to the plugin mechanism. Subclass for specific plugin Exceptions.