Skip to content

Commit

Permalink
Merge pull request #414 from CleanTalk/mscan_logs_upd_after_tests.ag
Browse files Browse the repository at this point in the history
Updated parsing url on admin actions collection
  • Loading branch information
alexandergull authored Sep 13, 2024
2 parents 1499c93 + ba363f3 commit 53b8128
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions inc/spbc-tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,13 @@ function spbc_parse_action_from_admin_page_uri($url, $post_id = null)
$skip_request = isset($parsed_query['tab']) && $parsed_query['tab'] === 'plugin-information';
if ( isset($parsed_query['plugin']) && !$skip_request ) {
if (is_callable('get_plugin_data')) {
$plugin_name = get_plugin_data(WP_PLUGIN_DIR . '/' . $parsed_query['plugin'])['Name'];
$plugin_path = WP_PLUGIN_DIR . '/' . $parsed_query['plugin'];
if (@is_dir($plugin_path) && @is_readable($plugin_path)) {
$plugin_data = get_plugin_data($plugin_path);
if (isset($plugin_data['Name'])) {
$plugin_name = $plugin_data['Name'];
}
}
}
if (empty($plugin_name)) {
$plugin_name = explode('/', $parsed_query['plugin'])[0];
Expand Down Expand Up @@ -913,15 +919,8 @@ function spbc_parse_action_from_admin_page_uri($url, $post_id = null)
$out['add_time'] = false;
break;
default:
preg_match_all('/\/wp-admin\/(.+\.php)\?(action=.+?)&/', $url, $matches);
$file = !empty($matches[1]) && !empty($matches[1][0]) ? $matches[1][0] : '';
$the_action = !empty($matches[2]) && !empty($matches[2][0]) ? $matches[2][0] : '';
$event = !empty($file) && !empty($the_action) ? $file . '...' . $the_action : 'view';
// shortening to 16 symbols
$event = strlen($event) > 16
? '..' . substr($event, -14, -14)
: $event;
$out['action_event'] = $event;
// removed parsing the actions to unify parsing on the cloud
$out['action_event'] = 'view';
$out['add_time'] = false;
}
return $out;
Expand Down

0 comments on commit 53b8128

Please sign in to comment.