<?php
/*
 * Developed By Devozon
 *
 * Check Out at https://devozon.com/
 * Email: support@devozon.com
 * Message: https://www.facebook.com/devozon
 *
 * Please feel free to contact me at any time if you need a custom script or any development work.
 *
 * Devozon Team:
 * Coded by Sanad Nabil
 * Theme by Ahmed Reda
 * Tested By Smith Carter
 *
 * Devozon All rights reserved
 * Copyright (c) 2023.
 * Last Update 12 \ 11 \ 2023
 */

if ( !defined( 'ABSPATH' ) ) {
	exit;
}

function FENSE_BPVT_plugin_settings( $Fense_FUN )
{
	
	$transient = get_transient( 'fense_bpvt_plugin_settings' );
	$expires = is_array( $transient ) && isset( $transient['time'] ) ? (int)$transient['time'] : 0;
	
	// Key
	$key = 'FENSE_BPVT_DEVOZON_';
	
	if ( time() >= $expires ) {
		
		$settings = new stdClass();
		
		$settings->enable = esc_attr( get_option( $key . 'enable_dtg' ) );
		$settings->enable_on_logged = esc_attr( get_option( $key . 'enable_on_logged_users' ) );
		$settings->enable_on_posts = esc_attr( get_option( $key . 'enable_on_posts' ) );
		$settings->enable_on_pages = esc_attr( get_option( $key . 'enable_on_pages' ) );
		$settings->enable_on = esc_attr( get_option( $key . 'enable_on_custom' ) );
		
		$settings->enable_cache = esc_attr( get_option( $key . 'enable_cache' ) );
		$settings->enable_on_login = esc_attr( get_option( $key . 'enable_on_login' ) );
		
		$settings->enable_country = get_option( $key . 'enable_country' );
		$settings->disable_country = get_option( $key . 'disable_country' );
		
		$settings->re_enable_country = get_option( $key . 'restrict_enable_country' );
		$settings->re_disable_country = get_option( $key . 'restrict_disable_country' );
		
		$settings->protection_mode = esc_attr( get_option( $key . 'protection_mode' ) );
		$settings->message = get_option( $key . 'restrict_message' );
		$settings->url = esc_attr( get_option( $key . 'redirect_to_url' ) );
		$settings->disable_link = esc_attr( get_option( $key . 'show_link' ) );
		$settings->link = esc_attr( get_option( $key . 'show_link_val' ) );
		$settings->block_domains = $Fense_FUN->banned_multi_domains_list( get_option( $key . 'restrict_domain' ) );
		
		$settings->crawlers_bots = get_option( $key . 'crawlers_bots' );
		$settings->crawlers_bots_data = get_option( $key . 'crawlers_bots_data' );
		
		$settings->ip_whitelisting_enable = get_option( $key . 'ip_whitelisting_enable' );
		$settings->ip_whitelisting = get_option( $key . 'ip_whitelisting' );
		$settings->ip_whitelisting_range = get_option( $key . 'ip_whitelisting_range' );
		
		$settings->ip_blacklisting_enable = get_option( $key . 'ip_blacklisting_enable' );
		$settings->ip_blacklisting = get_option( $key . 'ip_blacklisting' );
		$settings->ip_blacklisting_range = get_option( $key . 'ip_blacklisting_range' );
		
		set_transient( 'fense_bpvt_plugin_settings', [ 'settings' => $settings, 'time' => time() + 1800 ], 2 * 3600 );
		
		return $settings;
	}
	
	return $transient['settings'];
}
