Skip to content

Commit

Permalink
v 0.26.1
Browse files Browse the repository at this point in the history
- Avoid seeing action logs as source when nothing else exists.
  • Loading branch information
Darklg committed Nov 3, 2024
1 parent 7577706 commit f4ec950
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions wpuactionlogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Plugin URI: https://github.com/WordPressUtilities/wpuactionlogs
Update URI: https://github.com/WordPressUtilities/wpuactionlogs
Description: Useful logs about what’s happening on your website admin.
Version: 0.26.0
Version: 0.26.1
Author: Darklg
Author URI: https://darklg.me/
Text Domain: wpuactionlogs
Expand All @@ -26,7 +26,7 @@ class WPUActionLogs {
public $baseadmindatas;
public $settings_details;
public $settings;
private $plugin_version = '0.26.0';
private $plugin_version = '0.26.1';
private $transient_active_duration = 60;
private $plugin_settings = array(
'id' => 'wpuactionlogs',
Expand All @@ -36,6 +36,10 @@ class WPUActionLogs {
private $settings_obj;
private $last_post_id;
private $admin_page_id = 'wpuactionlogs-main';
private $excluded_functions = array(
'get_call_stack',
'log_line',
);

public function __construct() {
add_filter('plugins_loaded', array(&$this,
Expand Down Expand Up @@ -331,6 +335,11 @@ public function get_call_stack() {
if (strpos($trace['file'], 'wp-content/') === false) {
continue;
}
if (strpos($trace['file'], 'plugins/wpuactionlogs') !== false) {
if (isset($trace['function']) && in_array($trace['function'], $this->excluded_functions)) {
continue;
}
}
preg_match('/wp-content\/([a-z0-9-_]+)\/([a-z0-9-_]+)\//isU', $trace['file'], $matches);
if (!$matches) {
continue;
Expand All @@ -339,10 +348,6 @@ public function get_call_stack() {
}
$files = array_unique($files);

if (count($files) > 1 && ($key = array_search('plugins/wpuactionlogs', $files)) !== false) {
unset($files[$key]);
}

return $files;

}
Expand Down Expand Up @@ -481,7 +486,7 @@ public function wpubaseadmindatas_cellcontent($cellcontent, $cell_id, $settings)
if (is_array($var_display) && isset($var_display[0])) {
$var_display = implode(', ', $var_display);
}
if(is_array($var_display)){
if (is_array($var_display)) {
$var_display = json_encode($var_display);
}
$cellcontent .= '<li><strong>' . $key . ' : </strong><span>' . $var_display . '</span></li>';
Expand Down Expand Up @@ -649,7 +654,7 @@ public function load_actions() {
'edit_category',
'create_term',
'delete_term',
'delete_category',
'delete_category'
);
foreach ($term_hooks as $term_hook) {
add_action($term_hook, array(&$this,
Expand Down Expand Up @@ -740,7 +745,7 @@ public function action__terms($term_id, $tt_id, $taxonomy, $old_term = false) {
return;
}

if(is_array($taxonomy) && isset($taxonomy['taxonomy'])){
if (is_array($taxonomy) && isset($taxonomy['taxonomy'])) {
$taxonomy = $taxonomy['taxonomy'];
}

Expand Down

0 comments on commit f4ec950

Please sign in to comment.