https://t.me/AnonymousX5
Server : LiteSpeed
System : Linux server354.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64
User : getfsxkz ( 1681)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /home/getfsxkz/theaztech.org/wp-content/plugins/complianz-gdpr/websitescan/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/getfsxkz/theaztech.org/wp-content/plugins/complianz-gdpr/websitescan/class-wsc-logger.php
<?php

defined('ABSPATH') or die();

if (!class_exists("cmplz_wsc_logger")) {

	class cmplz_wsc_logger
	{
		public function init_hooks()
		{
			add_action( 'cmplz_every_month_hook', array( $this, 'clear_errors_log') );
		}

		/**
		 * Logs an error related to a specific $context and stores it in a WordPress option.
		 *
		 * @param string $context The $context name or identifier related to the error.
		 * @param string $error_message The error message to log.
		 */
		public static function log_errors(string $context, string $error_message = ''): void
		{
			// If WP_DEBUG is enabled, log the error to the error log
			if (defined('WP_DEBUG') && WP_DEBUG) {
				error_log("COMPLIANZ: error in context '$context': " . $error_message);
			}

			// Get existing errors from the options table
			$errors = get_option('cmplz_wsc_logs', array());

			$sanitized_context = sanitize_text_field($context);
			$sanitized_error_message = sanitize_text_field($error_message);
			$sanitized_timestamp = current_time('mysql');

			// Append the new error
			$errors[] = array(
				'context' => $sanitized_context,
				'error_message' => $sanitized_error_message,
				'timestamp' => $sanitized_timestamp
			);
			$sanitized_errors = array_map( function( $error ) {
				return array(
					'context' => sanitize_text_field( $error['context'] ),
					'error_message' => sanitize_text_field( $error['error_message'] ),
					'timestamp' => sanitize_text_field( $error['timestamp'] ),
				);
			}, $errors );

			// Update the option with the new error log
			update_option('cmplz_wsc_logs', $sanitized_errors, false);
		}

		/**
		 * Retrieves all logged errors from the WordPress options.
		 *
		 * @return array The array of logged errors.
		 */
		public function get_errors_log(): array
		{
			// Retrieve the errors stored in the WordPress option
			return get_option('cmplz_wsc_logs', array());
		}

		/**
		 * Clears all logged errors from the WordPress options.
		 */
		public function clear_errors_log(): void
		{
			// Delete the option to clear all stored errors
			delete_option('cmplz_wsc_logs');
		}
	}
}

https://t.me/AnonymousX5 - 2025