aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/plugins.php
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-16 23:10:19 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-16 23:10:19 +0000
commit05edae9a09b52f4e0aad5c1a6bdfa17eae4426cb (patch)
tree44e02e1944855d26bb04b2302e933c46aa63343e /engine/lib/plugins.php
parent8203c8bd6c099146591ad3391fee3c40578e2e6d (diff)
downloadelgg-05edae9a09b52f4e0aad5c1a6bdfa17eae4426cb.tar.gz
elgg-05edae9a09b52f4e0aad5c1a6bdfa17eae4426cb.tar.bz2
More intelligent context detection. Refs #32
git-svn-id: https://code.elgg.org/elgg/trunk@939 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/plugins.php')
-rw-r--r--engine/lib/plugins.php25
1 files changed, 17 insertions, 8 deletions
diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php
index 036a2d5b9..f12ed3cac 100644
--- a/engine/lib/plugins.php
+++ b/engine/lib/plugins.php
@@ -51,16 +51,25 @@
*
* @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];
+ function get_plugin_name($mainfilename = false) {
+ if (!$mainfilename) {
+ 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];
+ }
}
}
+ } else {
+ $file = $_SERVER["SCRIPT_NAME"];
+ $file = str_replace("\\","/",$file);
+ $file = str_replace("//","/",$file);
+ if (preg_match("/mod\/([a-zA-Z0-9\-\_]*)\//",$file,$matches)) {
+ return $matches[1];
+ }
}
return false;
}