<?php
use Bdp\Libs\FileAccess as FileAccess;
use Bdp\Libs\WpConfigEditor as WpConfigEditor;

function is_xmlrpc_disabled() : bool {
    return FileAccess::htaccessContains(_protect_wp_disablexmlrpc_string());
}

function is_authorscan_blocked() : bool {
    return get_option('protect_wp_hide_authors', false);
}

function is_execution_in_uploads_blocked() : bool {
    return FileAccess::htaccessContains(_protect_wp_disable_script_execution_string(), FileAccess::HTACCESS_UPLOADS);
}

function is_access_for_special_files_prohibited() : bool {
    return FileAccess::htaccessContains(_protect_wp_disable_special_files_string());
}

function is_file_editor_diabled() : bool {
    $isDisabled = WpConfigEditor::getConfigValue('DISALLOW_FILE_EDIT');
    if (null == $isDisabled) {
        return false;
    }

    if ('false' == $isDisabled) {
        return false;
    }

    return true;
}

function is_conatenation_disabled() : bool {
    $isDisabled = WpConfigEditor::getConfigValue('CONCATENATE_SCRIPTS');
    if (null == $isDisabled) {
        return false;
    }

    if ('false' == $isDisabled) {
        return false;
    }

    return true;
}

function is_includedir_protected() : bool {
    return FileAccess::htaccessContains(_protect_wp_secure_include_dir_string());
}

function is_directory_listing_disabled() : bool {
    return FileAccess::htaccessContains(_protect_wp_disable_directory_listing_string());
}


function is_bot_access_prohibited() : bool {
    return get_option('protect_wp_prohibit_bot_access', false);
}

function get_prohibitedbot_list() {
    $returnValue = [];

    $botList = get_option('protect_wp_prohibit_bot_list', null);
    if ($botList !== null) {
        $returnValue = unserialize(trim($botList));
    }
    return $returnValue;
}

function is_wp_debug_diabled() : bool
{
    $wpDebugValue = WpConfigEditor::getConfigValue('WP_DEBUG');
    return ('false' == $wpDebugValue || null == $wpDebugValue);
}

function is_login_rewritten() : ?string
{
	return get_option('kompass_sec_rewrite_login', null);
}