diff options
author | Benaka Moorthi <benaka.moorthi@gmail.com> | 2013-09-24 10:15:11 +0400 |
---|---|---|
committer | Benaka Moorthi <benaka.moorthi@gmail.com> | 2013-09-24 10:15:11 +0400 |
commit | 3433a3d353a86c4c001693dedeea102c06b4c19e (patch) | |
tree | 902d8bce481a6bad1f3d9670bd4a3e287e5b5473 /core/Plugin.php | |
parent | c6350fbba5b80a89aaef2b660632c171dfb9a33a (diff) |
Finished converting exception handling.
Diffstat (limited to 'core/Plugin.php')
-rw-r--r-- | core/Plugin.php | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/core/Plugin.php b/core/Plugin.php index 5f0c809896..c8f48590a4 100644 --- a/core/Plugin.php +++ b/core/Plugin.php @@ -193,4 +193,18 @@ class Plugin { return $this->pluginName; } -} + + public static function getPluginNameFromBacktrace($backtrace) + { + $plugin = false; + foreach ($backtrace as $tracepoint) { + // try and discern the plugin name + if (empty($plugin)) { + if (preg_match("/^Piwik\\Plugins\\([a-z_]+)\\/", $tracepoint['class'], $matches)) { + $plugin = $matches[1]; + } + } + } + return $plugin ?: 'unknown'; + } +}
\ No newline at end of file |