aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/plugins.php
diff options
context:
space:
mode:
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;
}