Skip to content

Commit

Permalink
fixing get_plugin_name & get_plugin_dir func
Browse files Browse the repository at this point in the history
  • Loading branch information
MehediDracula committed Jul 27, 2015
1 parent 5b57c7e commit 19a359a
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions lib/function.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 19a359a

Please sign in to comment.