PluginProbe ʕ •ᴥ•ʔ
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode / trunk
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode vtrunk
4.7.2 4.7.1 trunk 2.3.0 2.4.0 2.4.1 2.4.2 2.5.0 3.0.0 3.0.1 3.1.0 3.10.0 3.10.1 3.11.1 3.11.2 3.11.3 3.2.0 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.6.1 3.6.2 3.6.5 3.6.6 3.7.0 3.7.1 3.8.0 3.9.0 4.0.0 4.0.1 4.0.2 4.0.3 4.1.0 4.1.1 4.2.0 4.2.1 4.2.10 4.2.11 4.2.12 4.2.13 4.2.14 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.3.10 4.3.11 4.3.12 4.3.2 4.3.3 4.3.4 4.3.5 4.3.6 4.3.7 4.3.7.1 4.3.8 4.3.9 4.3.9.1 4.4.0 4.4.1 4.4.2 4.5.0 4.5.1 4.5.10 4.5.11 4.5.2 4.5.3 4.5.4 4.5.5 4.5.6 4.5.7 4.5.8 4.5.9 4.6.0 4.6.1 4.6.2 4.6.3 4.6.4 4.6.5 4.6.6 4.6.7 4.7.0
cookiebot / src / abilities / Ability_Audit_Logger.php
cookiebot / src / abilities Last commit date
Ability_Audit_Logger.php 1 month ago Cookiebot_Abilities_Registrar.php 1 month ago Cookiebot_Ability_Interface.php 1 month ago Get_Compliance_Summary_Ability.php 1 month ago Get_Status_Ability.php 1 month ago Install_Ppg_Ability.php 1 month ago Set_Cbid_Ability.php 1 month ago Toggle_Gcm_Ability.php 1 month ago Verify_Setup_Ability.php 1 month ago
Ability_Audit_Logger.php
47 lines
1 <?php
2
3 namespace cybot\cookiebot\abilities;
4
5 /**
6 * Class Ability_Audit_Logger
7 *
8 * Logs AI ability executions for audit trails, capping at 50 most recent entries.
9 *
10 * @package cybot\cookiebot\abilities
11 */
12 class Ability_Audit_Logger {
13
14 const OPTION_NAME = 'cookiebot-ai-action-log';
15 const MAX_ENTRIES = 50;
16
17 /**
18 * Log an ability execution.
19 *
20 * @param string $ability_name e.g. 'cookiebot/set-cbid'
21 * @param mixed $old_value The value before the change
22 * @param mixed $new_value The value after the change
23 *
24 * @return void
25 *
26 * @since 4.8.0
27 */
28 public function log( $ability_name, $old_value, $new_value ) {
29 $log = get_option( self::OPTION_NAME, array() );
30 if ( ! is_array( $log ) ) {
31 $log = array();
32 }
33 array_unshift(
34 $log,
35 array(
36 'ts' => time(),
37 'ability' => $ability_name,
38 'user_id' => get_current_user_id(),
39 'old' => $old_value,
40 'new' => $new_value,
41 )
42 );
43 $log = array_slice( $log, 0, self::MAX_ENTRIES );
44 update_option( self::OPTION_NAME, $log, false );
45 }
46 }
47