time(), 'message' => $message, ); update_option( self::OPTION, array_slice( $log, -self::MAX ), false ); /** * Fires when Consiva.ai records a warning. * * @param string $message Warning. */ do_action( 'consiva_consent_log', $message ); if ( defined( 'WP_DEBUG' ) && WP_DEBUG && defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) { error_log( 'Consiva.ai: ' . $message ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log -- only when the site owner turned on WP_DEBUG_LOG. } } /** * @return array */ public static function recent() { $log = get_option( self::OPTION, array() ); return is_array( $log ) ? $log : array(); } }