From 19a359a4a2d2e570f8c88630239760052a9b7ae4 Mon Sep 17 00:00:00 2001 From: Mehedi Hassan Date: Mon, 27 Jul 2015 07:32:51 +0600 Subject: [PATCH] fixing get_plugin_name & get_plugin_dir func --- lib/function.php | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/lib/function.php b/lib/function.php index aca627f..ab5b174 100755 --- a/lib/function.php +++ b/lib/function.php @@ -516,30 +516,19 @@ function db_delete($tbl_name, $where) { } } -function get_plugin_dir() { - $backtrace = debug_backtrace(); +function get_plugin_name() { + $backtrace = array_shift(debug_backtrace()); - foreach($backtrace as $trace) { - if($trace['function'] == 'get_plugin_dir') { - $filePath = $trace['file']; - preg_match("/.*?plugins.(.*?)\\\\|\\//", $filePath, $matches); + preg_match("/.*?plugins.*?.(.*_vor)/", dirname($backtrace['file']), $matches); - return 'plugins/'.$matches[1]; - } - } + return $matches[1]; } -function get_plugin_name() { - $backtrace = debug_backtrace(); - - foreach($backtrace as $trace) { - if($trace['function'] == 'get_plugin_name') { - $filePath = $trace['file']; - preg_match("/.*?plugins.(.*?)\\\\|\\//", $filePath, $matches); +function get_plugin_dir() { + $backtrace = array_shift(debug_backtrace()); + preg_match("/.*?plugins.*?.(.*_vor)/", dirname($backtrace['file']), $matches); - return $matches[1]; - } - } + return 'plugins/'.$matches[1]; } function add_css($css_files) {