| Server IP : 65.108.144.40 / Your IP : 216.73.217.165 Web Server : Apache/2.4.52 (Ubuntu) System : Linux ubuntu-8gb-hel1-1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64 User : dev ( 1000) PHP Version : 8.2.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/pia/wp-content/plugins/wp-security-audit-log/classes/ |
Upload File : |
<?php
/**
* Abstract logger class.
*
* @package wsal
* @subpackage loggers
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Abstract class used in the Logger.
*
* @see Loggers/Database.php
* @package wsal
*/
abstract class WSAL_AbstractLogger {
/**
* Instance of WpSecurityAuditLog.
*
* @var WpSecurityAuditLog
*/
protected $plugin;
/**
* Method: Constructor.
*
* @param WpSecurityAuditLog $plugin - Instance of WpSecurityAuditLog.
*
* @since 1.0.0
*/
public function __construct( WpSecurityAuditLog $plugin ) {
$this->plugin = $plugin;
}
/**
* Log alert abstract.
*
* @param integer $type - Alert code.
* @param array $data - Metadata.
* @param integer $date (Optional) - Created on.
* @param integer $site_id (Optional) - Site id.
*/
abstract public function log( $type, $data = array(), $date = null, $site_id = null );
/**
* Determines what is the correct timestamp for the event.
*
* It uses the timestamp from metadata if available. This is needed because we introduced a possible delay by using
* action scheduler in 4.3.0. The $legacy_date attribute is only used for migration of legacy data. This should be
* removed in future releases.
*
* @param array $metadata Event metadata.
* @param int $legacy_date Legacy date only used when migrating old db event format to the new one.
*
* @return float GMT timestamp including microseconds.
* @since 4.3.0
*/
protected function get_correct_timestamp( $metadata, $legacy_date ) {
if ( is_null( $legacy_date ) ) {
$timestamp = current_time( 'U.u', true );
$timestamp = \apply_filters( 'wsal_database_timestamp_value', $timestamp, $metadata );
return array_key_exists( 'Timestamp', $metadata ) ? $metadata['Timestamp'] : current_time( 'U.u', true );
}
return floatval( $legacy_date );
}
}