From 6c43d1868f0772570de3591a1b46c6767dc656ae Mon Sep 17 00:00:00 2001 From: Yakir Sitbon Date: Sun, 7 Jun 2026 14:44:22 +0300 Subject: [PATCH 01/10] Bump WP version --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index fa964e6..43e7997 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: elemntor, KingYes, ariel.k, maor Tags: Activity Log, User Log, Audit Log, Security, Email Log, Requires at least: 6.0 Requires PHP: 7.0 -Tested up to: 6.7 +Tested up to: 7.0 Stable tag: 2.11.2 License: GPLv2 or later From 03e069edd71ecd2262bf456eae6144b76de7bb0d Mon Sep 17 00:00:00 2001 From: Yakir Sitbon Date: Thu, 13 Aug 2026 14:42:23 +0300 Subject: [PATCH 02/10] New: Added source of the request --- assets/css/activity-log-table.css | 172 +++++++++++++++++ classes/class-aal-activity-log-list-table.php | 77 ++++++++ classes/class-aal-admin-ui.php | 119 +----------- classes/class-aal-api.php | 182 ++++++++++++++++-- classes/class-aal-export.php | 26 +++ classes/class-aal-maintenance.php | 122 +++++++++++- classes/class-aal-privacy.php | 28 +++ 7 files changed, 599 insertions(+), 127 deletions(-) create mode 100644 assets/css/activity-log-table.css diff --git a/assets/css/activity-log-table.css b/assets/css/activity-log-table.css new file mode 100644 index 0000000..55ad1ce --- /dev/null +++ b/assets/css/activity-log-table.css @@ -0,0 +1,172 @@ +/* Activity Log – Admin table styles */ + +/* Menu icon (all admin screens) */ +#adminmenu #toplevel_page_activity-log-page div.wp-menu-image:before { + content: "\f321"; +} + +/* Page title icon */ +h1.aal-page-title:before { + content: "\f321"; + font: 400 25px/1 dashicons !important; + speak: none; + color: #030303; + display: inline-block; + padding-inline-end: .2em; + vertical-align: -18%; +} + +/* Export button */ +#record-actions-submit { + margin-top: 10px; +} + +/* Post type badge (existing) */ +.aal-pt { + color: #ffffff; + padding: 1px 4px; + margin: 0 5px; + font-size: 1em; + border-radius: 3px; + background: #808080; + font-family: inherit; +} + +/* Column widths */ +.toplevel_page_activity-log-page .manage-column { + width: auto; +} + +.toplevel_page_activity-log-page .column-description { + width: 20%; +} + +/* Reset filter link */ +#aal-reset-filter { + display: inline-block; + margin-inline-start: 5px; + line-height: 30px; + text-decoration: none; +} + +#aal-reset-filter .dashicons { + font-size: 15px; + line-height: 30px; + text-decoration: none; +} + +/* Promotion row */ +.aal-table-promotion-row td { + padding: 0; +} + +.aal-table-promotion-inner { + position: relative; + display: flex; + align-items: center; + justify-content: space-between; + padding: 20px; + background: white; + border: 1px solid #4C43E5; + border-inline-start-width: 3px; +} + +.aal-promotion-cta { + margin-inline-start: 5px; + font-weight: bold; + color: #4C43E5; +} + +.aal-promotion-dismiss { + display: flex; + align-items: center; + transition: all .1s ease-in-out; + border: none; + margin: 0; + padding: 0; + background: none; + cursor: pointer; + color: #7c7c7c; +} + +.aal-promotion-dismiss::before { + content: '\f335'; + display: block; + font: normal 20px/20px dashicons; + height: 20px; + width: 20px; + text-align: center; +} + +.aal-promotion-dismiss:hover { + color: #4C43E5; +} + +/* Source badges in User column */ +.aal-source-badge { + display: inline-block; + font-size: 11px; + line-height: 1.4; + padding: 1px 6px; + margin-top: 4px; + margin-inline-end: 4px; + border-radius: 3px; + background: #f0f0f1; + color: #50575e; + text-decoration: none; + vertical-align: baseline; +} + +.aal-source-badge:hover { + background: #dcdcde; + color: #2c3338; +} + +.aal-source-badge--channel { + background: #e7f4f9; + color: #2271b1; +} + +.aal-source-badge--channel:hover { + background: #d4eaf4; + color: #135e96; +} + +.aal-source-badge--app { + background: #fcf0e6; + color: #9a4e0e; +} + +.aal-source-badge--app:hover { + background: #f5e1cf; + color: #703800; +} + +/* Source column */ +.toplevel_page_activity-log-page .column-source { + width: 12%; +} + +/* Responsive */ +@media (max-width: 767px) { + .toplevel_page_activity-log-page .manage-column { + width: auto; + } + + .toplevel_page_activity-log-page .column-date, + .toplevel_page_activity-log-page .column-author { + display: table-cell; + width: auto; + } + + .toplevel_page_activity-log-page .column-ip, + .toplevel_page_activity-log-page .column-description, + .toplevel_page_activity-log-page .column-label, + .toplevel_page_activity-log-page .column-source { + display: none; + } + + .toplevel_page_activity-log-page .column-author .avatar { + display: none; + } +} diff --git a/classes/class-aal-activity-log-list-table.php b/classes/class-aal-activity-log-list-table.php index 7175b11..e22be8c 100644 --- a/classes/class-aal-activity-log-list-table.php +++ b/classes/class-aal-activity-log-list-table.php @@ -171,6 +171,7 @@ public function get_columns() { 'date' => __( 'Date', 'aryo-activity-log' ), 'author' => __( 'User', 'aryo-activity-log' ), 'ip' => __( 'IP', 'aryo-activity-log' ), + 'source' => __( 'Source', 'aryo-activity-log' ), 'type' => __( 'Topic', 'aryo-activity-log' ), 'label' => __( 'Context', 'aryo-activity-log' ), 'description' => __( 'Meta', 'aryo-activity-log' ), @@ -181,6 +182,10 @@ public function get_columns() { unset( $columns['ip'] ); } + if ( ! AAL_Maintenance::is_schema_ready( '1.1' ) ) { + unset( $columns['source'] ); + } + return $columns; } @@ -375,6 +380,42 @@ public function column_author( $item ) { ); } + public function column_source( $item ) { + $raw = isset( $item->request_source ) ? $item->request_source : ''; + if ( '' === $raw ) { + return ''; + } + + $parsed = AAL_API::parse_request_source( $raw ); + $badges = ''; + $channel_labels = AAL_API::get_channel_labels(); + + if ( ! empty( $parsed['channel'] ) && isset( $channel_labels[ $parsed['channel'] ] ) ) { + $badges .= sprintf( + '%s', + esc_url( $this->get_filtered_link( 'sourceshow', $parsed['channel'] ) ), + esc_html( $channel_labels[ $parsed['channel'] ] ) + ); + } + + if ( ! empty( $parsed['app_name'] ) ) { + $badges .= sprintf( + '%s', + esc_url( $this->get_filtered_link( 'sourceshow', 'app_password' ) ), + esc_attr__( 'Application Password', 'aryo-activity-log' ), + esc_html( $parsed['app_name'] ) + ); + } elseif ( '' === $parsed['app_name'] && false !== strpos( $raw, 'app:' ) ) { + $badges .= sprintf( + '%s', + esc_url( $this->get_filtered_link( 'sourceshow', 'app_password' ) ), + esc_html__( 'App Password', 'aryo-activity-log' ) + ); + } + + return $badges; + } + public function column_type( $item ) { $return = __( $item->object_type, 'aryo-activity-log' ); @@ -677,12 +718,35 @@ public function extra_tablenav( $which ) { echo ''; } + if ( AAL_Maintenance::is_schema_ready( '1.1' ) ) { + if ( ! isset( $_REQUEST['sourceshow'] ) ) { + $_REQUEST['sourceshow'] = ''; + } + + $source_options = array( + '' => __( 'All Sources', 'aryo-activity-log' ), + 'abilities' => __( 'WP Abilities', 'aryo-activity-log' ), + 'rest' => __( 'REST API', 'aryo-activity-log' ), + 'xmlrpc' => __( 'XML-RPC', 'aryo-activity-log' ), + 'cli' => __( 'WP-CLI', 'aryo-activity-log' ), + 'cron' => __( 'WP-Cron', 'aryo-activity-log' ), + 'app_password' => __( 'App Password', 'aryo-activity-log' ), + ); + + echo ''; + } + $filters = array( 'dateshow', 'capshow', 'usershow', 'typeshow', 'showaction', + 'sourceshow', ); foreach ( $filters as $filter ) { @@ -729,6 +793,19 @@ public function prepare_items() { $where .= $wpdb->prepare( ' AND `user_caps` = %s', strtolower( sanitize_text_field( $_REQUEST['capshow'] ) ) ); } + if ( AAL_Maintenance::is_schema_ready( '1.1' ) && ! empty( $_REQUEST['sourceshow'] ) ) { + $source_filter = sanitize_key( $_REQUEST['sourceshow'] ); + if ( 'app_password' === $source_filter ) { + $where .= " AND (`request_source` LIKE '%|app:%' OR `request_source` LIKE 'app:%')"; + } else { + $where .= $wpdb->prepare( + " AND (`request_source` = %s OR `request_source` LIKE %s)", + $source_filter, + $wpdb->esc_like( $source_filter ) . '|%' + ); + } + } + if ( isset( $_REQUEST['dateshow'] ) ) { $current_time = current_time( 'timestamp' ); diff --git a/classes/class-aal-admin-ui.php b/classes/class-aal-admin-ui.php index 578d75e..42549bc 100644 --- a/classes/class-aal-admin-ui.php +++ b/classes/class-aal-admin-ui.php @@ -31,108 +31,6 @@ public function activity_log_page_func() { - -