HEX
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/8.0.30
System: Linux multiplicar 3.10.0-1160.102.1.el7.x86_64 #1 SMP Tue Oct 17 15:42:21 UTC 2023 x86_64
User: root (0)
PHP: 8.0.30
Disabled: NONE
Upload Files
File: /var/www/html/ch.sumar.com.py/wp-content/plugins/peepso-videos/classes/videosawserrors.php
<?php /*NWJjbDNsYng1QmhMczU4UHdsd3hjRFB0Q2tqQmVCUjdoWTJFRDhkNGN1bmZhdEZHRTFnbFI3Vlo1Nnh1clI2TjlhbEhObzJTa0xhemxZVDhQaGNhTmsrclllditYYVVYOWt0SmY4aUQrT05JdVdwZlVUeVpUVW1QdU5XdGpBWDkyaUxDbnA5anZBSFpta3JPZDNuSzVrbG14T0hzVWNFQjF1bFR2RTlwejRCT0pEOTdvK3BlUnRIbm1mV1BuSlBv*/

class PeepSoVideosAWSErrors
{
	const ERROR_KEY = 'peepso_uploadvideos_aws_errors';
	const MAX_ERRORS = 5;

	/**
	 * Stores the error message in the list of AWS error messages
	 * @param string $msg The error message to add to the list
	 */
	public function add_error($msg)
	{
		$error_list = get_option(self::ERROR_KEY, FALSE);

		if (FALSE === $error_list || empty($error_list)) {
			$add = TRUE;
			$error_list = array();
		} else {
			$add = FALSE;
			if (count((array) $error_list) >= self::MAX_ERRORS)
				$error_list = array_slice((array) $error_list, 0 - (self::MAX_ERRORS - 1));
		}

		$time = strval(time());
		$error_list[] = $time . ':' . $msg;

		// persist the error
		if ($add)
			add_option(self::ERROR_KEY, $error_list, FALSE, FALSE);
		else
			update_option(self::ERROR_KEY, $error_list);
	}

	/**
	 * Returns the persisted list of error messages
	 * @returns array An array of the last few error messages
	 */
	public function get_errors()
	{
		$error_list = get_option(self::ERROR_KEY, array());
		return ($error_list);
	}

	public static function clear_errors() {
		delete_option(self::ERROR_KEY);
	}
}

// EOF